-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraise complaint pc.html
150 lines (135 loc) · 5.5 KB
/
raise complaint pc.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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/c81e574e1d.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Raise a Complaint - Municipality</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: auto;
padding: 20px;
background-color: white;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
margin-top: 50px;
}
h2 {
text-align: center;
font-family: Roboto;
font-size: 40px;
font-weight: bold;
}
label {
display: block;
margin-top: 10px;
font-weight: bold;
}
input, textarea, button {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 10px;
}
button {
background-color: #4CAF50;
color: white;
cursor: pointer;
width: 20%;
border:none;
}
button:hover {
background-color: #45a049;
border:none;
}
.camera-preview {
width: 100%;
margin-top: 20px;
max-height: 300px;
object-fit: cover;
margin-bottom: 10px;
border-radius: 10px;
}
.button{
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h2>Raise a Complaint</h2>
<!-- Geolocation Section -->
<label for="location">Location (Automatically Tagged):</label>
<div class="mr-2"><input type="text" id="location" placeholder="Fetching your location..." readonly></div>
<div class="button"><button id="getLocation">Get My Location</button></div>
<!-- Camera Capture Section -->
<label for="camera">Capture an Image of the Issue:</label>
<video id="cameraStream" class="camera-preview"></video>
<div class="button"><button id="captureImage">Capture Image</button></div>
<canvas id="cameraOutput" class="camera-preview" style="display:none;"></canvas>
<!-- Upload Image -->
<label for="imageUpload">Or Upload an Image:</label>
<input type="file" id="imageUpload" accept="image/*">
<!-- Description -->
<label for="description">Description:</label>
<textarea id="description" rows="4" placeholder="Describe the issue..."></textarea>
<!-- Submit Button -->
<div class="button"><button id="submitComplaint">Submit Complaint</button>
<a href="ecosweep.html"><button>Back</button></a></div>
</div>
<script>
// Geolocation
const getLocationButton = document.getElementById('getLocation');
const locationInput = document.getElementById('location');
getLocationButton.addEventListener('click', () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
const { latitude, longitude } = position.coords;
locationInput.value = `Lat: ${latitude}, Long: ${longitude}`;
}, () => {
locationInput.value = "Unable to fetch location.";
});
} else {
locationInput.value = "Geolocation is not supported by this browser.";
}
});
// Camera Access
const cameraStream = document.getElementById('cameraStream');
const cameraOutput = document.getElementById('cameraOutput');
const captureButton = document.getElementById('captureImage');
const canvas = cameraOutput.getContext('2d');
// Access the camera
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video:true })
.then(stream => {
cameraStream.srcObject = stream;
cameraStream.play();
});
}
// Capture Image
captureButton.addEventListener('click', () => {
canvas.drawImage(cameraStream, 0, 0, cameraOutput.width, cameraOutput.height);
cameraOutput.style.display = 'block';
cameraStream.style.display = 'none';
});
// Submit Complaint (Just a mockup of submission)
const submitButton = document.getElementById('submitComplaint');
submitButton.addEventListener('click', () => {
const description = document.getElementById('description').value;
const location = locationInput.value;
alert(`Complaint submitted!\nLocation: ${location}\nDescription: ${description}`);
});
</script>
</body>
</html>