roshnn24 commited on
Commit
14b6dbb
·
verified ·
1 Parent(s): 6d3ecaa

Upload 5 files

Browse files
templates/activity-log.html ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <link href='https://fonts.googleapis.com/css?family=Poppins:400,700&display=swap' rel='stylesheet'>
7
+ <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
+ <title>Farm Tech System - Activity Log</title>
10
+ <style>
11
+ :root {
12
+ --primary-color: #2C5F2D;
13
+ --secondary-color: #97BC62;
14
+ --text-color: #333;
15
+ --background-color: rgba(255, 255, 255, 0.9);
16
+ }
17
+
18
+ body {
19
+ font-family: 'Poppins', sans-serif;
20
+ background-image: url('https://media.istockphoto.com/id/136546538/photo/tea-plantation.jpg?s=612x612&w=0&k=20&c=CMMc6rLPJTvuhwYhj2Q7XjNT4acTi5iUiAGnHsgOPkw=');
21
+ background-size: cover;
22
+ background-repeat: no-repeat;
23
+ background-attachment: fixed;
24
+ color: var(--text-color);
25
+ margin: 0;
26
+ padding: 0;
27
+ }
28
+
29
+ .container {
30
+ max-width: 1200px;
31
+ margin: 0 auto;
32
+ padding: 20px;
33
+ background-color: var(--background-color);
34
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
35
+ border-radius: 10px;
36
+ }
37
+
38
+ .animate-charcter {
39
+ text-align: center;
40
+ background-image: linear-gradient(
41
+ -225deg,
42
+ #231557 0%,
43
+ #44107a 29%,
44
+ #ff1361 67%,
45
+ #fff800 100%
46
+ );
47
+ background-size: 200% auto;
48
+ color: #AC3B61;
49
+ background-clip: text;
50
+ text-fill-color: transparent;
51
+ -webkit-background-clip: text;
52
+ -webkit-text-fill-color: transparent;
53
+ animation: textclip 2s linear infinite;
54
+ font-size: 48px;
55
+ font-weight: bold;
56
+ margin-bottom: 20px;
57
+ }
58
+
59
+ @keyframes textclip {
60
+ to {
61
+ background-position: 200% center;
62
+ }
63
+ }
64
+
65
+ .navbar {
66
+ background-color: var(--primary-color);
67
+ padding: 10px 0;
68
+ margin-bottom: 20px;
69
+ }
70
+
71
+ .nav-links {
72
+ list-style: none;
73
+ padding: 0;
74
+ display: flex;
75
+ justify-content: center;
76
+ }
77
+
78
+ .nav-links li {
79
+ margin: 0 15px;
80
+ }
81
+
82
+ .nav-links a {
83
+ color: white;
84
+ font-weight: bold;
85
+ font-size: 18px;
86
+ text-decoration: none;
87
+ transition: all 0.3s ease;
88
+ }
89
+
90
+ .nav-links li:hover a {
91
+ background: white;
92
+ color: var(--primary-color);
93
+ padding: 5px 10px;
94
+ border-radius: 25px;
95
+ }
96
+
97
+ h2 {
98
+ color: var(--primary-color);
99
+ font-size: 28px;
100
+ margin-top: 30px;
101
+ margin-bottom: 20px;
102
+ }
103
+
104
+ #welcome-section img {
105
+ max-width: 100%;
106
+ height: auto;
107
+ margin-bottom: 30px;
108
+ border-radius: 10px;
109
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
110
+ }
111
+
112
+ footer {
113
+ background-color: var(--primary-color);
114
+ color: white;
115
+ text-align: center;
116
+ padding: 20px 0;
117
+ margin-top: 40px;
118
+ }
119
+ </style>
120
+ </head>
121
+ <body>
122
+ <div class="container">
123
+ <header>
124
+ <h1 class="animate-charcter">Farm Tech System - Activity Log</h1>
125
+ <nav class="navbar">
126
+ <ul class="nav-links">
127
+ <li><a href="{{ url_for('home') }}"><i class="fas fa-home"></i> Dashboard</a></li>
128
+ <li><a href="sensors"><i class="fas fa-cogs"></i> Sensors</a></li>
129
+ <li><a href="zones"><i class="fas fa-envelope"></i> Zones</a></li>
130
+ </ul>
131
+ </nav>
132
+ </header>
133
+
134
+ <section id="welcome-section">
135
+ <h2>IR Value Distribution</h2>
136
+ <img src="data:image/png;base64,{{ ir_plot_data }}" alt="IR Value Distribution">
137
+
138
+ <h2>Average Closeness of Pests over Time</h2>
139
+ <img src="data:image/png;base64,{{ distance_plot_data }}" alt="Average Closeness of Pests over Time">
140
+ </section>
141
+ </div>
142
+
143
+ <footer>
144
+ <p>&copy; 2024 Farm Tech System. All rights reserved.</p>
145
+ </footer>
146
+ </body>
147
+ </html>
templates/index.html ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
7
+ <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
+ <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
10
+ <title>Farm Tech System</title>
11
+ <style>
12
+ body {
13
+ font-family: Arial, sans-serif;
14
+ }
15
+ .container {
16
+ display: flex;
17
+ justify-content: space-between;
18
+ margin-top: 20px;
19
+ text-align: center;
20
+ }
21
+ .column {
22
+ flex: 0 0 48%;
23
+ padding: 30px;
24
+ border: 1px solid #ccc;
25
+ box-shadow: 2px 2px 12px #aaa;
26
+ background-color: rgba(240, 240, 240, 0.7);
27
+ }
28
+ .attention {
29
+ background-color: #ffcccc;
30
+ padding: 10px;
31
+ border: 1px solid #ff6666;
32
+ margin-bottom: -200px;
33
+ text-align: center;
34
+ width: 48%;
35
+ box-sizing: border-box;
36
+ animation: blink 1s infinite;
37
+ }
38
+ @keyframes blink {
39
+ 0% { background-color: #ffcccc; }
40
+ 50% { background-color: #ff9999; }
41
+ 100% { background-color: #ffcccc; }
42
+ }
43
+ @keyframes pulsate {
44
+ 0% { opacity: 1; }
45
+ 50% { opacity: 0.5; }
46
+ 100% { opacity: 1; }
47
+ }
48
+ .attention p {
49
+ font-weight: bold;
50
+ color: #cc0000;
51
+ margin: 0;
52
+ }
53
+ .attention span {
54
+ color: blue;
55
+ }
56
+ .attention-left {
57
+ margin-right: 10px;
58
+ }
59
+ .attention-right {
60
+ margin-left: auto;
61
+ }
62
+ .live {
63
+ animation: pulsate 1s infinite;
64
+ color: red;
65
+ font-weight: bold;
66
+ }
67
+ .chatbot-icon, .voice-icon {
68
+ position: fixed;
69
+ bottom: 30px;
70
+ background-color: #AC3B61;
71
+ color: #fff;
72
+ border-radius: 50%;
73
+ width: 70px;
74
+ height: 70px;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ cursor: pointer;
79
+ transition: transform 0.3s;
80
+ font-size: 24px;
81
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
82
+ }
83
+ .chatbot-icon {
84
+ right: 30px;
85
+ }
86
+ .voice-icon {
87
+ right: 110px;
88
+ }
89
+ .voice-active {
90
+ animation: pulse 1s infinite;
91
+ }
92
+ @keyframes pulse {
93
+ 0% { transform: scale(1); }
94
+ 50% { transform: scale(1.1); }
95
+ 100% { transform: scale(1); }
96
+ }
97
+ .chatbox {
98
+ position: fixed;
99
+ bottom: 120px;
100
+ right: 30px;
101
+ width: 400px;
102
+ max-width: 90%;
103
+ height: 600px;
104
+ max-height: 80vh;
105
+ background: #fff;
106
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
107
+ border-radius: 20px;
108
+ display: none;
109
+ flex-direction: column;
110
+ overflow: hidden;
111
+ }
112
+ .chatbox-header {
113
+ padding: 15px;
114
+ font-size: 20px;
115
+ background: linear-gradient(45deg, #AC3B61, #8E2D4E);
116
+ color: white;
117
+ border-top-left-radius: 20px;
118
+ border-top-right-radius: 20px;
119
+ }
120
+ .chatbox-body {
121
+ height: calc(100% - 130px);
122
+ padding: 20px;
123
+ overflow-y: auto;
124
+ background-color: #f7f7f7;
125
+ }
126
+ .chatbox-footer {
127
+ padding: 15px;
128
+ background-color: white;
129
+ border-bottom-left-radius: 20px;
130
+ border-bottom-right-radius: 20px;
131
+ display: flex;
132
+ align-items: center;
133
+ }
134
+ .chatbox-footer input {
135
+ flex: 1;
136
+ padding: 12px;
137
+ border: 1px solid #ddd;
138
+ border-radius: 25px;
139
+ font-size: 16px;
140
+ margin-right: 10px;
141
+ }
142
+ .chatbox-footer button {
143
+ padding: 12px 20px;
144
+ background: linear-gradient(45deg, #AC3B61, #8E2D4E);
145
+ color: white;
146
+ border: none;
147
+ border-radius: 25px;
148
+ font-size: 16px;
149
+ cursor: pointer;
150
+ transition: background 0.3s ease;
151
+ }
152
+ .chatbox-footer button:hover {
153
+ background: linear-gradient(45deg, #8E2D4E, #AC3B61);
154
+ }
155
+ .message {
156
+ margin-bottom: 12px;
157
+ padding: 8px 12px;
158
+ border-radius: 16px;
159
+ max-width: 80%;
160
+ word-wrap: break-word;
161
+ animation: fadeIn 0.3s ease;
162
+ font-size: 14px; /* Reduced font size for chat messages */
163
+ }
164
+
165
+ .user-message {
166
+ background-color: #E1F5FE;
167
+ color: #0277BD;
168
+ margin-left: auto;
169
+ }
170
+ .bot-message {
171
+ background-color: #FFF3E0;
172
+ color: #E65100;
173
+ }
174
+ @keyframes fadeIn {
175
+ from { opacity: 0; transform: translateY(10px); }
176
+ to { opacity: 1; transform: translateY(0); }
177
+ }
178
+ .typing-indicator {
179
+ display: inline-block;
180
+ }
181
+ .typing-indicator span {
182
+ display: inline-block;
183
+ animation: blink 1.4s infinite both;
184
+ }
185
+ .typing-indicator span:nth-child(2) {
186
+ animation-delay: .2s;
187
+ }
188
+ .typing-indicator span:nth-child(3) {
189
+ animation-delay: .4s;
190
+ }
191
+ </style>
192
+ </head>
193
+ <body>
194
+ <div class="body">
195
+ <div class="container">
196
+ <div class="row">
197
+ <div class="col-md-12 text-center">
198
+ <h1 class="animate-charcter">Farm Tech System-Home</h1>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ <header>
203
+ <nav class="navbar">
204
+ <ul class="nav-links">
205
+ <li><a href="sensors"><i class="fas fa-home"></i> Sensors</a></li>
206
+ <li><a href="zones"><i class="fas fa-cogs"></i> Zones</a></li>
207
+ <li><a href="activity-log"><i class="fas fa-envelope"></i> Activity Log</a></li>
208
+ <li><a href="notification"><i class="fas fa-bell"></i> Notifications</a></li>
209
+ </ul>
210
+ </nav>
211
+ </header>
212
+ <main>
213
+ <h1 style="text-align: center; color: white;">Test your crop health!!!</h1>
214
+
215
+ <p style="font-size: 20px; text-align: center; color: white;">
216
+ Temperature: 32°C, Humidity: 95%, Moisture: High (<span class="live">live</span>)
217
+ </p>
218
+
219
+ <div class="container">
220
+ <div class="attention attention-left">
221
+ <p>
222
+ Attention: This weather condition may lead to outbreak of <span>Tea mosquito bug</span> (Action Needed)
223
+ </p>
224
+ </div>
225
+ <div class="attention attention-right">
226
+ <p>
227
+ Attention: This weather condition may lead to outbreak of <span>Blister blight disease</span> (Action Needed)
228
+ </p>
229
+ </div>
230
+ </div>
231
+
232
+ <div class="container">
233
+ <div class="column">
234
+ <h2>Tea Crop Pest Detection</h2>
235
+ <form method="post" enctype="multipart/form-data">
236
+ <input type="file" name="pest_file" accept="image/*" required>
237
+ <br><br>
238
+ <input type="submit" value="Upload">
239
+ </form>
240
+ {% if pest_filename %}
241
+ <h3>Uploaded Photo:</h3>
242
+ <img src="{{ url_for('uploaded_file', filename=pest_filename) }}" alt="Uploaded Photo" style="max-width: 100%; height: auto;">
243
+ <h3>Detected Pest: <span>Tea mosquito bug</span></h3>
244
+ <p>Remedy:</p>
245
+ <ul>
246
+ <li>Spray neem oil on the affected areas.</li>
247
+ <li>Use yellow sticky traps to catch the bugs.</li>
248
+ <li>Plant trap crops like castor or sunflower to divert them away from tea plants.</li>
249
+ </ul>
250
+ <audio id="pest_audio" src="{{ url_for('audio_file', filename=pest_audio_file) }}" controls autoplay></audio>
251
+ {% endif %}
252
+ </div>
253
+ <div class="column">
254
+ <h2>Tea Crop Disease Detection</h2>
255
+ <form method="post" enctype="multipart/form-data">
256
+ <input type="file" name="disease_file" accept="image/*" required>
257
+ <br><br>
258
+ <input type="submit" value="Upload">
259
+ </form>
260
+ {% if disease_filename %}
261
+ <h3>Uploaded Photo:</h3>
262
+ <img src="{{ url_for('uploaded_file', filename=disease_filename) }}" alt="Uploaded Photo" style="max-width: 100%; height: auto;">
263
+ <h3>Detected Disease: <span>Brown Blight disease</span></h3>
264
+ <p>Remedy:</p>
265
+ <ul>
266
+ <li>Remove and destroy infected leaves.</li>
267
+ <li>Apply copper-based fungicides.</li>
268
+ <li>Ensure proper air circulation around the plants.</li>
269
+ </ul>
270
+ <audio id="disease_audio" src="{{ url_for('audio_file', filename=disease_audio_file) }}" controls autoplay></audio>
271
+ {% endif %}
272
+ </div>
273
+ </div>
274
+ </main>
275
+ </div>
276
+
277
+ <!-- Chatbot Icon -->
278
+ <div class="chatbot-icon" id="chatbotIcon">
279
+ <i class="fas fa-comments"></i>
280
+ </div>
281
+
282
+ <!-- Voice Icon -->
283
+ <div class="voice-icon" id="voiceIcon">
284
+ <i class="fas fa-microphone"></i>
285
+ </div>
286
+
287
+ <!-- Chatbox -->
288
+ <div class="chatbox" id="chatbox">
289
+ <div class="chatbox-header">Chat with AI</div>
290
+ <div class="chatbox-body" id="chatBody">
291
+ <!-- Chat content goes here -->
292
+ </div>
293
+ <div class="chatbox-footer">
294
+ <input type="text" placeholder="Type your message here..." id="chatInput">
295
+ <button id="sendButton">Send</button>
296
+ </div>
297
+ </div>
298
+
299
+ <script>
300
+ // JavaScript to handle the chatbot toggle
301
+ document.getElementById('chatbotIcon').addEventListener('click', function() {
302
+ var chatbox = document.getElementById('chatbox');
303
+ if (chatbox.style.display === 'none' || chatbox.style.display === '') {
304
+ chatbox.style.display = 'flex';
305
+ } else {
306
+ chatbox.style.display = 'none';
307
+ }
308
+ });
309
+
310
+ // JavaScript for voice recognition
311
+ var recognition;
312
+ if ('webkitSpeechRecognition' in window) {
313
+ recognition = new webkitSpeechRecognition();
314
+ } else if ('SpeechRecognition' in window) {
315
+ recognition = new SpeechRecognition();
316
+ } else {
317
+ alert('Your browser does not support speech recognition.');
318
+ }
319
+
320
+ if (recognition) {
321
+ recognition.continuous = false;
322
+ recognition.interimResults = false;
323
+
324
+ recognition.onstart = function() {
325
+ document.getElementById('voiceIcon').classList.add('voice-active');
326
+ };
327
+
328
+ recognition.onend = function() {
329
+ document.getElementById('voiceIcon').classList.remove('voice-active');
330
+ };
331
+
332
+ recognition.onresult = function(event) {
333
+ var transcript = event.results[0][0].transcript;
334
+ document.getElementById('chatInput').value = transcript;
335
+ };
336
+
337
+ document.getElementById('voiceIcon').addEventListener('click', function() {
338
+ recognition.start();
339
+ });
340
+ }
341
+
342
+ // Chat functionality
343
+ $(document).ready(function() {
344
+ $('#sendButton').click(sendMessage);
345
+ $('#chatInput').keypress(function(e) {
346
+ if (e.which == 13) {
347
+ sendMessage();
348
+ }
349
+ });
350
+
351
+ function sendMessage() {
352
+ var message = $('#chatInput').val();
353
+ if (message.trim() !== '') {
354
+ appendMessage('user', message);
355
+ $('#chatInput').val('');
356
+
357
+ // Show a typing indicator
358
+ appendMessage('bot', '<div class="typing-indicator">Typing<span>.</span><span>.</span><span>.</span></div>');
359
+
360
+ $.ajax({
361
+ url: '/chat',
362
+ method: 'POST',
363
+ contentType: 'application/json',
364
+ data: JSON.stringify({message: message}),
365
+ success: function(response) {
366
+ // Remove the typing indicator
367
+ $('.typing-indicator').parent().remove();
368
+ appendMessage('bot', response.response);
369
+ },
370
+ error: function() {
371
+ // Remove the typing indicator
372
+ $('.typing-indicator').parent().remove();
373
+ appendMessage('bot', 'Sorry, there was an error processing your request.');
374
+ }
375
+ });
376
+ }
377
+ }
378
+
379
+ function appendMessage(sender, message) {
380
+ var messageClass = sender === 'user' ? 'user-message' : 'bot-message';
381
+ $('#chatBody').append('<div class="message ' + messageClass + '">' + message + '</div>');
382
+ $('#chatBody').scrollTop($('#chatBody')[0].scrollHeight);
383
+ }
384
+ });
385
+ </script>
386
+ </body>
387
+ </html>
templates/notification.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/sensors.html ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Farm Tech System - Sensors</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@700&family=Open+Sans&display=swap" rel="stylesheet">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
+ <style>
10
+ :root {
11
+ --dark-green: #2C5F2D;
12
+ --light-green: #97BC62;
13
+ --brown: #6A4028;
14
+ --cream: #F2E8CF;
15
+ }
16
+
17
+ body {
18
+ font-family: 'Open Sans', sans-serif;
19
+ background-color: var(--cream);
20
+ color: var(--brown);
21
+ margin: 0;
22
+ padding: 0;
23
+ }
24
+
25
+ .navbar {
26
+ background-color: var(--dark-green);
27
+ padding: 1rem;
28
+ position: fixed;
29
+ width: 100%;
30
+ top: 0;
31
+ z-index: 1000;
32
+ }
33
+
34
+ .nav-links {
35
+ list-style: none;
36
+ display: flex;
37
+ justify-content: center;
38
+ margin: 0;
39
+ padding: 0;
40
+ }
41
+
42
+ .nav-links li {
43
+ margin: 0 15px;
44
+ }
45
+
46
+ .nav-links a {
47
+ color: var(--cream);
48
+ text-decoration: none;
49
+ font-weight: bold;
50
+ transition: color 0.3s ease;
51
+ }
52
+
53
+ .nav-links a:hover {
54
+ color: var(--light-green);
55
+ }
56
+
57
+ .container {
58
+ max-width: 1200px;
59
+ margin: 80px auto 0;
60
+ padding: 2rem;
61
+ }
62
+
63
+ h1, h2, h3 {
64
+ font-family: 'Merriweather', serif;
65
+ color: var(--dark-green);
66
+ }
67
+
68
+ .sensor-grid {
69
+ display: grid;
70
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
71
+ gap: 2rem;
72
+ margin-top: 2rem;
73
+ }
74
+
75
+ .sensor-card {
76
+ background-color: white;
77
+ border-radius: 8px;
78
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
79
+ padding: 1.5rem;
80
+ text-align: center;
81
+ transition: transform 0.3s ease;
82
+ }
83
+
84
+ .sensor-card:hover {
85
+ transform: translateY(-5px);
86
+ }
87
+
88
+ .sensor-icon {
89
+ font-size: 3rem;
90
+ color: var(--dark-green);
91
+ margin-bottom: 1rem;
92
+ }
93
+
94
+ .sensor-name {
95
+ font-weight: bold;
96
+ margin-bottom: 0.5rem;
97
+ }
98
+
99
+ .sensor-data {
100
+ font-size: 1.2rem;
101
+ color: var(--brown);
102
+ }
103
+
104
+ .timestamp {
105
+ text-align: center;
106
+ margin-top: 2rem;
107
+ font-style: italic;
108
+ color: var(--brown);
109
+ }
110
+ </style>
111
+ </head>
112
+ <body>
113
+ <!-- Navigation menu -->
114
+ <nav class="navbar">
115
+ <ul class="nav-links">
116
+ <li><a href="{{ url_for('home') }}"><i class="fas fa-home"></i> Dashboard</a></li>
117
+ <li><a href="{{ url_for('zones') }}"><i class="fas fa-cogs"></i> Zones</a></li>
118
+ <li><a href="{{ url_for('activity_log') }}"><i class="fas fa-envelope"></i> Activity Log</a></li>
119
+ </ul>
120
+ </nav>
121
+
122
+ <div class="container">
123
+ <h1>Farm Tech System - Sensors</h1>
124
+
125
+ <div class="sensor-grid">
126
+ <div class="sensor-card">
127
+ <i class="fas fa-wave-square sensor-icon"></i>
128
+ <p class="sensor-name">Ultrasonic Transducer</p>
129
+ <p class="sensor-data">Distance: {{ sensor_data.distance }} cm</p>
130
+ </div>
131
+ <div class="sensor-card">
132
+ <i class="fas fa-bug sensor-icon"></i>
133
+ <p class="sensor-name">IR Sensor</p>
134
+ <p class="sensor-data">Pest Swarm: {{ 'Detected' if sensor_data.irValue == 0 else 'Not Detected' }}</p>
135
+ </div>
136
+ <div class="sensor-card">
137
+ <i class="fas fa-thermometer-half sensor-icon"></i>
138
+ <p class="sensor-name">Environmental Sensor</p>
139
+ <p class="sensor-data">Temperature: {{ sensor_data.temperature }} &#8451;</p>
140
+ <p class="sensor-data">Humidity: {{ sensor_data.humidity }}%</p>
141
+ </div>
142
+ <div class="sensor-card">
143
+ <i class="fas fa-running sensor-icon"></i>
144
+ <p class="sensor-name">PIR Sensor</p>
145
+ <p class="sensor-data">Motion: {{ 'Detected' if sensor_data.irValue == 0 else 'Not Detected' }}</p>
146
+ </div>
147
+ <div class="sensor-card">
148
+ <i class="fas fa-lightbulb sensor-icon"></i>
149
+ <p class="sensor-name">UV Light (Sticky Trap)</p>
150
+ <p class="sensor-data">Status: Normal</p>
151
+ </div>
152
+ </div>
153
+
154
+ <div class="timestamp">
155
+ <p>Last updated: {{ sensor_data.timestamp }}</p>
156
+ </div>
157
+ </div>
158
+ </body>
159
+ </html>
templates/zones.html ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Farm Tech System - Zones</title>
7
+ <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
8
+ <style>
9
+ /* Added CSS styles */
10
+ .animate-charcter {
11
+ text-align: center;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ background-image: linear-gradient(
16
+ -225deg,
17
+ #231557 0%,
18
+ #44107a 29%,
19
+ #ff1361 67%,
20
+ #fff800 100%
21
+ );
22
+ background-size: auto auto;
23
+ background-clip: border-box;
24
+ background-size: 200% auto;
25
+ color: #AC3B61;
26
+ background-clip: text;
27
+ text-justify: transparent;
28
+ -webkit-background-clip: text;
29
+ -webkit-text-fill-color: transparent;
30
+ animation: textclip 2s linear infinite;
31
+ display: inline-block;
32
+ font-size: 80px;
33
+ font-family: Georgia, 'Times New Roman', Times, serif;
34
+ font-weight: bold;
35
+ }
36
+
37
+ @keyframes textclip {
38
+ to {
39
+ background-position: center;
40
+ }
41
+ }
42
+
43
+ * {
44
+ margin-bottom: 20px;
45
+ padding: 0;
46
+ box-sizing: border-box;
47
+ }
48
+
49
+ body {
50
+ align-items: center;
51
+ justify-content: center;
52
+ background: url('{{ url_for('static', filename='backgrnd.jpg') }}') no-repeat center center fixed;
53
+ background-size: cover;
54
+ color: #fff; /* Ensuring the text is readable on a dark background */
55
+ }
56
+
57
+ @keyframes scroll {
58
+ 0% {
59
+ transform: translateX(0);
60
+ }
61
+ 100% {
62
+ transform: translateX(calc(-250px * 7));
63
+ }
64
+ }
65
+
66
+ .slider {
67
+ height: 200px;
68
+ margin: auto;
69
+ overflow: hidden;
70
+ position: relative;
71
+ width: auto;
72
+ padding: 0 30px;
73
+ }
74
+
75
+ .logo {
76
+ font-family: 'Poppins';
77
+ font-size: 24px;
78
+ text-align: center;
79
+ }
80
+
81
+ .navbar {
82
+ margin-top: 20px;
83
+ }
84
+
85
+ .nav-links {
86
+ list-style: none;
87
+ padding: 0;
88
+ display: flex;
89
+ justify-content: center;
90
+ }
91
+
92
+ .nav-links li {
93
+ margin: 0 15px;
94
+ }
95
+
96
+ .nav-links a {
97
+ color: #AC3B61;
98
+ font-weight: bolder;
99
+ font-size: larger;
100
+ text-decoration: none;
101
+ }
102
+
103
+ h2 {
104
+ font-size: 24px;
105
+ margin-bottom: 10px;
106
+ }
107
+
108
+ p {
109
+ line-height: 1.6;
110
+ }
111
+
112
+ .nav-links li:hover a {
113
+ background: rgb(255, 255, 255);
114
+ color: black;
115
+ padding: .25rem .5rem;
116
+ transition: all ease-in 300ms;
117
+ border-radius: 25px;
118
+ }
119
+
120
+ .container {
121
+ display: flex;
122
+ flex-direction: column;
123
+ align-items: center;
124
+ }
125
+
126
+ .box {
127
+ display: flex;
128
+ justify-content: center;
129
+ flex-wrap: wrap;
130
+ }
131
+
132
+ .dream {
133
+ text-align: center;
134
+ }
135
+
136
+ .dream .item {
137
+ margin: 10px;
138
+ }
139
+
140
+ .dream img {
141
+ display: block;
142
+ margin: 0 auto;
143
+ }
144
+
145
+ .dream .item p {
146
+ font-size: 20px; /* Increased font size */
147
+ color: red; /* Changed text color to red */
148
+ margin-top: 10px;
149
+ }
150
+
151
+ #map, #zoneMap {
152
+ height: 500px;
153
+ width: 80%;
154
+ margin: 20px auto;
155
+ }
156
+
157
+ </style>
158
+ </head>
159
+ <body>
160
+ <header>
161
+ <h1 class="animate-charcter">Farm Tech System - Zones</h1>
162
+ <!-- Navigation menu -->
163
+ <nav class="navbar">
164
+ <ul class="nav-links">
165
+ <li><a href="home"><i class="fas fa-home"></i> Home</a></li>
166
+ <li><a href="sensors"><i class="fas fa-sensors"></i> Sensors</a></li>
167
+ <li><a href="activity-log"><i class="fas fa-envelope"></i> Activity Log</a></li>
168
+
169
+ </ul>
170
+ </nav>
171
+ </header>
172
+
173
+ <!-- Zones content -->
174
+ <section>
175
+ <div id="map"></div>
176
+ <div id="zoneMap"></div>
177
+ </section>
178
+
179
+ <!-- Footer -->
180
+ <footer>
181
+ <!-- Footer content -->
182
+ </footer>
183
+
184
+ <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
185
+ <script src="https://unpkg.com/leaflet.heat/dist/leaflet-heat.js"></script>
186
+ <script>
187
+ var map = L.map('map').setView([10.3269, 76.9512], 16); // Increased zoom level for closer view
188
+
189
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
190
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
191
+ }).addTo(map);
192
+
193
+ // Add a marker for the tea estate
194
+ L.marker([10.3269, 76.9512]).addTo(map)
195
+ .bindPopup('Tea Estate in Valparai Hills')
196
+ .openPopup();
197
+
198
+ // Define the coordinates of the boundary of the tea estate
199
+ var estateBoundary = [
200
+ [10.3275, 76.9500],
201
+ [10.3272, 76.9510],
202
+ [10.3270, 76.9520],
203
+ [10.3268, 76.9525],
204
+ [10.3265, 76.9527],
205
+ [10.3260, 76.9525],
206
+ [10.3255, 76.9520],
207
+ [10.3252, 76.9515],
208
+ [10.3250, 76.9510],
209
+ [10.3252, 76.9505],
210
+ [10.3255, 76.9500],
211
+ [10.3260, 76.9495],
212
+ [10.3265, 76.9492],
213
+ [10.3270, 76.9495]
214
+ ];
215
+
216
+ // Add the boundary as a polygon
217
+ L.polygon(estateBoundary, {color: 'red'}).addTo(map)
218
+ .bindPopup('Tea Estate Boundary');
219
+
220
+ // Add a heatmap layer
221
+ var heat = L.heatLayer([
222
+ [10.3269, 76.9512, 0.5], // Example coordinates with intensity
223
+ [10.3270, 76.9520, 0.6],
224
+ [10.3280, 76.9530, 0.7]
225
+ ], {radius: 25}).addTo(map);
226
+
227
+ // Additional map for zones
228
+ var zoneMap = L.map('zoneMap').setView([10.3269, 76.9512], 16);
229
+
230
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
231
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
232
+ }).addTo(zoneMap);
233
+
234
+ // Define coordinates for zone boundaries
235
+ var zone1 = [
236
+ [10.3280, 76.9500],
237
+ [10.3280, 76.9515],
238
+ [10.3270, 76.9515],
239
+ [10.3270, 76.9500]
240
+ ];
241
+
242
+ var zone2 = [
243
+ [10.3280, 76.9515],
244
+ [10.3280, 76.9530],
245
+ [10.3270, 76.9530],
246
+ [10.3270, 76.9515]
247
+ ];
248
+
249
+ var zone3 = [
250
+ [10.3270, 76.9500],
251
+ [10.3270, 76.9515],
252
+ [10.3260, 76.9515],
253
+ [10.3260, 76.9500]
254
+ ];
255
+
256
+ var zone4 = [
257
+ [10.3270, 76.9515],
258
+ [10.3270, 76.9530],
259
+ [10.3260, 76.9530],
260
+ [10.3260, 76.9515]
261
+ ];
262
+
263
+ // Add zones as polygons
264
+ L.polygon(zone1, {color: 'blue'}).addTo(zoneMap).bindPopup('Zone 1');
265
+ L.polygon(zone2, {color: 'green'}).addTo(zoneMap).bindPopup('Zone 2');
266
+ L.polygon(zone3, {color: 'yellow'}).addTo(zoneMap).bindPopup('Zone 3');
267
+ L.polygon(zone4, {color: 'orange'}).addTo(zoneMap).bindPopup('Zone 4');
268
+
269
+ // Add heatmap layers for zones
270
+ var zoneHeatData = [
271
+ // Example heat data for each zone
272
+ [10.3275, 76.9505, 0.5], // Zone 1
273
+ [10.3275, 76.9525, 0.6], // Zone 2
274
+ [10.3265, 76.9505, 0.7], // Zone 3
275
+ [10.3265, 76.9525, 0.8] // Zone 4
276
+ ];
277
+
278
+ L.heatLayer(zoneHeatData, {radius: 25}).addTo(zoneMap);
279
+
280
+ </script>
281
+ </body>
282
+ </html>