-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
174 lines (149 loc) · 5.84 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dashboard</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/dashboard.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body onload="checkWeather('Auckland')">
<script src="https://kit.fontawesome.com/7552b865b0.js" crossorigin="anonymous"></script>
<!-- FontAwesome -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito&display=swap">
<!-- Nunito Font -->
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand header-element" href="#">
<img src="img/logoclear.png" alt="Logo" height="30">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="calendar.html">Calendar</a>
</li>
<li class="nav-item">
<a class="nav-link" href="friends.html">Friends</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
<div class="calendar">
<div class="col-sm-8">
<div id="calendar" class="calendar">
<img src="https://c.tadst.com/gfx/1200x675/calendar-2023-printable.png?1" width = 100% height = 70%>
</div>
</div>
</div>
<div class="col-sm-4">
<h3>Weather</h3>
<img src="images/weatherAPI.png" style = "display: inline-block">
<!--weather stuff i added here-->
<div class="search">
<input type="text" placeholder ="Enter city name" spellcheck="false">
<button>Go</button>
</div>
<div>
<p class="city">Auckland</p>
<p class="country">NZ</p>
<p>Today</p>
<p class="temp" id="temp0">20°C</p>
<p class="weather" id="weather0">Rain</p>
</div>
<div class="col-sm-4">
<div class="event">
<h3> Events </h3>
<ul class="list-group" id="eventList">
<!-- events will be dynamically added here -->
</ul>
</div>
</div>
</div>
</div>
<hr>
<!-- all local places api-->
<div class = "localplaces">
<h1>Find Local Places</h1>
<form id="addressForm" autocomplete="off">
<label for="address">Enter your address:</labe l><br>
<input type="text" id="address" name="address"><br>
<label for="filter">Select a filter:</label>
<select id="filter" name="filter">
<option value="">All</option>
<option value="restaurant">Restaurant</option>
<option value="cafe">Cafe</option>
<option value="gym">Gym</option>
<option value="park">Park</option>
<!-- Add more options for other place types -->
</select>
<label for="radius">Radius (in meters):</label>
<input type="number" id="radius" name="radius" min="0" value="1000"><br>
<input type="submit" value="Submit">
</form>
<div id="results"></div>
</div>
</div>
<!-- Include Firebase SDK -->
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script>
<!-- Your Firebase configuration script -->
<script src="js/dashboard_firebase.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCfxcu3MVidDCTccD21FRLmJhZg29nMZNI&libraries=places"></script>
<script>
document.getElementById('addressForm').addEventListener('submit', function(event) {
event.preventDefault(); // prevent the form from submitting normally
var address = document.getElementById('address').value;
var filter = document.getElementById('filter').value;
// Use the entered address and filter to fetch data from your server
fetch('http://localhost:3000/places', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ address: address, filter: filter }),
})
.then(function(response) {
if (response.ok) {
return response.json();
} else {
throw new Error('Server request failed with status ' + response.status);
}
})
.then(function(data) {
console.log(data); // Let's see what data is returned from the server
// Extract and display places data
var resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = '';
if (Array.isArray(data)) { // Check if data is an array
data.forEach(function(place) {
var p = document.createElement('p');
p.textContent = place.name;
resultsDiv.appendChild(p);
});
} else if (data.error) { // Check if there's an error message
var p = document.createElement('p');
p.textContent = data.error;
resultsDiv.appendChild(p);
}
})
.catch(function(error) {
console.error('Error:', error);
});
});
// Initialize autocomplete for the address input
var autocomplete = new google.maps.places.Autocomplete(document.getElementById('address'));
</script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.0.7/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>