-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport_damage.html
More file actions
208 lines (200 loc) · 7.01 KB
/
Copy pathreport_damage.html
File metadata and controls
208 lines (200 loc) · 7.01 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Report Damage</title>
<style>
body {
font-family: sans-serif;
margin: 0;
}
header {
background: #007bff;
color: white;
padding: 1rem;
display: flex;
align-items: center;
justify-content: space-between;
}
nav {
background: white;
padding: 0.5rem;
border-radius: 5px;
margin-top: 0.5rem;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
border-bottom: 1px solid #000;
border: 1px solid #000;
}
form {
margin: 2rem auto;
padding: 1rem;
background: #f2f2f2;
border-radius: 10px;
width: 90%;
max-width: 650px;
}
label {
display: block;
margin-top: 0.5rem;
font-weight: bold;
}
input, select, textarea {
padding: 0.5rem;
margin-top: 0.25rem;
border-radius: 5px;
border: 1px solid #ccc;
width: 100%;
}
.fields {
display: flex;
gap: 20px;
flex-wrap: wrap;
}
.fields input {
flex: 1;
min-width: 150px;
}
textarea {
resize: none;
height: 120px;
}
.char-count {
text-align: right;
font-size: 0.9em;
color: #666;
}
button.submit {
margin-top: 1rem;
background: #007bff;
color: white;
padding: 0.5rem 1rem;
border: none;
border-radius: 100px;
cursor: pointer;
width: 100%;
}
button.submit:hover {
background: #0056b3;
}
.report-button {
display: flex;
justify-content: center;
}
@media (max-width: 600px) {
.fields {
flex-direction: column;
}
.fields input, .fields select {
width: 100%;
margin-bottom: 1rem;
}
textarea {
width: 100%;
}
}
</style>
</head>
<body>
<header>
<nav>
<div class="dropdown">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/640px-Hamburger_icon.svg.png" alt="Menu" style="width: 30px; cursor: pointer;" />
<div class="dropdown-content">
<a href="alerts.html">Alerts</a>
<a href="educational_content.html">Educational Content</a>
<a href="report_damage.html">Report Damage</a>
<a href="provide_feedback.html">Provide Feedback</a>
<a href="view_feedback.html">View User Submitted Feedback</a>
<a href="view_reports.html">View User Submitted Reports</a>
</div>
</div>
</nav>
<h1 style="margin: 0">Report Damage</h1>
</header>
<form id="report" onsubmit="submitForm(event, 'Report')">
<div class="fields">
<input type="text" id="report-first" placeholder="First Name" required />
<input type="text" id="report-last" placeholder="Last Name" required />
<select id="parish-select" required>
<option value="">Select Parish</option>
<option value="Christ Church">Christ Church</option>
<option value="Saint Andrew">Saint Andrew</option>
<option value="Saint George">Saint George</option>
<option value="Saint James">Saint James</option>
<option value="Saint John">Saint John</option>
<option value="Saint Joseph">Saint Joseph</option>
<option value="Saint Lucy">Saint Lucy</option>
<option value="Saint Michael">Saint Michael</option>
<option value="Saint Peter">Saint Peter</option>
<option value="Saint Philip">Saint Philip</option>
<option value="Saint Thomas">Saint Thomas</option>
</select>
</div>
<br>
<label for="report-desc">Describe the details of the damage in the text box below:</label>
<textarea id="report-desc" rows="6" maxlength="200" required placeholder="Enter description here..."></textarea>
<div class="char-count">0/200 characters</div>
<div class="report-button">
<button type="submit" class="submit">Submit</button>
</div>
</form>
<script>
const textarea = document.getElementById('report-desc');
const charCount = document.querySelector('.char-count');
textarea.addEventListener('input', () => {
charCount.textContent = `${textarea.value.length}/200 characters`;
});
function submitForm(event, type) {
event.preventDefault();
const firstName = document.getElementById('report-first').value;
const lastName = document.getElementById('report-last').value;
const parish = document.getElementById('parish-select').value;
const description = document.getElementById('report-desc').value;
fetch('https://script.google.com/macros/s/AKfycbzlBLEKH3MVAxK4u6oHQR5uaW-G7AR4yZHB1y93QMlgvcf0Nyw5L2bD2zhtnTN5Waimrw/exec', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
firstName: firstName,
lastName: lastName,
parish: parish,
description: description
})
})
.then(response => response.json())
.then(data => {
if (data.result === "Success") {
alert("Report submitted successfully!");
document.getElementById('report').reset();
} else {
alert("Error submitting report.");
}
})
.catch(error => {
alert("Error: " + error);
});
}
</script>
</body>
</html>