-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovide_feedback.html
More file actions
192 lines (184 loc) · 6.09 KB
/
Copy pathprovide_feedback.html
File metadata and controls
192 lines (184 loc) · 6.09 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Provide Feedback</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 #000000;
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;
}
.feedback-button {
display: flex;
justify-content: center;
}
@media (max-width: 600px) {
.fields {
flex-direction: column;
}
.fields input {
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">Provide Feedback</h1>
</header>
<form id="feedback" onsubmit="submitForm(event, 'Feedback')">
<div class="fields">
<input type="text" id="feedback-first" placeholder="First Name" required />
<input type="text" id="feedback-last" placeholder="Last Name" required />
</div>
<br>
<label for="feedback-desc">Provide your feedback on what can be improved below:</label>
<textarea id="feedback-desc" rows="6" maxlength="200" required placeholder="Enter description here..."></textarea>
<div class="char-count">0/200 characters</div>
<div class="feedback-button">
<button type="submit" class="submit">Submit</button>
</div>
</form>
<script>
const textarea = document.getElementById('feedback-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('feedback-first').value;
const lastName = document.getElementById('feedback-last').value;
const description = document.getElementById('feedback-desc').value;
fetch('https://script.google.com/macros/s/AKfycbyaAleQ7SytywXPy0c8ufdep2w-74rC_YO-hRZEUKwnt42IS4N9nytGsJet1CjZvOsa/exec', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
firstName: firstName,
lastName: lastName,
description: description
})
})
.then(response => response.json())
.then(data => {
if (data.result === "Success") {
alert("Feedback submitted successfully!");
document.getElementById('feedback').reset();
} else {
alert("Error submitting feedback.");
}
})
.catch(error => {
alert("Error: " + error);
});
}
</script>
</body>
</html>