-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.html
More file actions
179 lines (152 loc) · 4.92 KB
/
profile.html
File metadata and controls
179 lines (152 loc) · 4.92 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AASHA</title>
<div class="logo">
<img src="ASSETS/logo.png">
</div>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: -webkit-linear-gradient(right,#cc6900,#e87b15,#ffaa5a, #f7cc87);
}
section {
max-width: 600px;
margin: 20px auto;
padding: 20px;
background-color: #ffffff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
form {
display: grid;
gap: 15px;
}
label {
font-weight: bold;
}
input, select {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #ff8800;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #ff6200;
}
#map {
height: 300px;
width: 100%;
margin-bottom: 15px;
}
.logo img{
float:left;
width: 100px;
height:auto;
}
</style>
</head>
<body>
<header>
<h1>AASHA</h1>
</header>
<section>
<h2>User Profile</h2>
<form id="profileForm">
<label for="fullName">Full Name:</label>
<input type="text" id="fullName" name="fullName" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="phone">Phone Number:</label>
<input type="tel" id="phone" name="phone" required>
<label for="emergencyContact">Emergency Contact:</label>
<input type="text" id="emergencyContact" name="emergencyContact" required>
<ul id="emergencyContactsList">
<!-- Emergency contacts will be dynamically added here -->
</ul>
<input type="text" id="newEmergencyContact" placeholder="Add new emergency contact">
<button type="button" onclick="addEmergencyContact()">Add Contact</button>
<label for="location">Current Location:</label>
<div id="map"></div>
<input type="text" id="location" name="location" required>
<label for="imageUpload">Upload Image:</label>
<input type="file" id="imageUpload" accept="image/*" onchange="handleImageUpload(event)">
<button type="submit">Update Profile</button>
</form>
<div id="alertMessage" style="display: none;"></div>
</section>
<script>
let map, infoWindow;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 0, lng: 0 },
zoom: 2
});
infoWindow = new google.maps.InfoWindow();
const locationButton = document.createElement("button");
locationButton.textContent = "Pan to Current Location";
locationButton.classList.add("custom-map-control-button");
map.controls[google.maps.ControlPosition.TOP_CENTER].push(locationButton);
locationButton.addEventListener("click", () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
const pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
infoWindow.setPosition(pos);
infoWindow.setContent("Location found.");
infoWindow.open(map);
map.setCenter(pos);
// Update the "Current Location" input field
const locationInput = document.getElementById('location');
locationInput.value = `${pos.lat}, ${pos.lng}`;
},
() => {
handleLocationError(true, infoWindow, map.getCenter());
},
);
} else {
handleLocationError(false, infoWindow, map.getCenter());
}
});
}
function handleLocationError(browserHasGeolocation, infoWindow, pos) {
infoWindow.setPosition(pos);
infoWindow.setContent(browserHasGeolocation ?
"Error: The Geolocation service failed." :
"Error: Your browser doesn't support geolocation.");
infoWindow.open(map);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyApfq9oJlL0Y_w3q4O_hMX8Sr4nCjv2Nno&callback=initMap&v=weekly" async defer></script>
<script>
function addEmergencyContact() {
const newContactInput = document.getElementById('newEmergencyContact');
const contactList = document.getElementById('emergencyContactsList');
const newContactValue = newContactInput.value.trim();
if (newContactValue !== '') {
const listItem = document.createElement('li');
listItem.textContent = newContactValue;
contactList.appendChild(listItem);
newContactInput.value = '';
}
}
</script>
<script type="module" src="profile.js"></script>
</body>
</html>