Browse Source

last commit

master
kirubaasagar.R 2 years ago
parent
commit
6e64ff2663
  1. 142
      src/main/resources/templates/User/registercomplaints.html
  2. 4
      src/main/resources/templates/checklistofficer/checklistofficer.html

142
src/main/resources/templates/User/registercomplaints.html

@ -1378,73 +1378,81 @@
}); });
}); */ }); */
$(document).ready(function () { $(document).ready(function () {
$('#submitButton').click(function (e) {
e.preventDefault(); // Prevent the default form submission
// Collect data from the form fields
var complainantName = $('#summaryName').text().trim();
var complainantAddr = $('#summaryStreet').text().trim();
var mobileNo = $('#summaryMobile').text().trim();
var email = $('#summaryEmail').text().trim();
var complaintType = $('#summaryComplaintType').text().trim();
var complaintTitle = $('#summaryComplaintTitle').text().trim();
var complaintDetails = $('#summaryDescription').text().trim();
var streetId = $('#summaryStreetId').text().trim();
var landmark = $('#summaryLandmark').text().trim();
var latitude = $('#summaryLatitude').text().trim();
var longtitude = $('#summaryLongitude').text().trim(); // Note the misspelling: it should match the controller parameter
var gender = $('#summaryGender').text().trim();
var imageSrc = $('#summaryImage').attr('src');
console.log({
ComplainantName: complainantName,
ComplainantAddr: complainantAddr,
MobileNo: mobileNo,
Email: email,
ComplaintType: complaintType,
ComplaintTitle: complaintTitle,
ComplaintDetails: complaintDetails,
StreetId: streetId,
Comp_Image: imageSrc,
latitude: latitude,
longtitude: longtitude,
Landmark: landmark,
gender: gender
});
// AJAX call to your backend controller
$.ajax({
url: '/register', // Update to your Spring Boot endpoint
type: 'POST',
data: {
ComplainantName: complainantName,
ComplainantAddr: complainantAddr,
MobileNo: mobileNo,
Email: email,
ComplaintType: complaintType,
ComplaintTitle: complaintTitle,
ComplaintDetails: complaintDetails,
StreetId: streetId,
Comp_Image: imageSrc,
latitude: latitude,
longtitude: longtitude, // Ensure this matches the controller parameter name
Landmark: landmark,
gender: gender
},
success: function (response) {
// Handle success response
console.log('Success:', response);
alert('Complaint registered successfully!');
// You can also redirect or reset the form here
},
error: function (xhr, status, error) {
// Improved error handling
console.log('Error:', xhr.responseText, status, error);
alert('Error: ' + xhr.status + ' ' + xhr.statusText);
}
});
});
});
$('#submitButton').click(function (e) {
e.preventDefault(); // Prevent the default form submission
// Collect data from the form fields
var complainantName = $('#summaryName').text().trim();
var complainantAddr = $('#summaryStreet').text().trim();
var mobileNo = $('#summaryMobile').text().trim();
var email = $('#summaryEmail').text().trim();
var complaintType = $('#summaryComplaintType').text().trim();
var complaintTitle = $('#summaryComplaintTitle').text().trim();
var complaintDetails = $('#summaryDescription').text().trim();
var streetId = $('#summaryStreetId').text().trim();
var landmark = $('#summaryLandmark').text().trim();
var latitude = $('#summaryLatitude').text().trim();
var longtitude = $('#summaryLongitude').text().trim(); // Note the misspelling
var gender = $('#summaryGender').text().trim();
var imageSrc = $('#summaryImage').attr('src');
console.log({
ComplainantName: complainantName,
ComplainantAddr: complainantAddr,
MobileNo: mobileNo,
Email: email,
ComplaintType: complaintType,
ComplaintTitle: complaintTitle,
ComplaintDetails: complaintDetails,
StreetId: streetId,
Comp_Image: imageSrc,
latitude: latitude,
longtitude: longtitude,
Landmark: landmark,
gender: gender
});
// AJAX call to your backend controller
$.ajax({
url: '/register', // Update to your Spring Boot endpoint
type: 'POST',
data: {
ComplainantName: complainantName,
ComplainantAddr: complainantAddr,
MobileNo: mobileNo,
Email: email,
ComplaintType: complaintType,
ComplaintTitle: complaintTitle,
ComplaintDetails: complaintDetails,
StreetId: streetId,
Comp_Image: imageSrc,
latitude: latitude,
longtitude: longtitude,
Landmark: landmark,
gender: gender
},
success: function (response) {
// SweetAlert upon success
Swal.fire({
title: 'Success!',
text: 'Your complaint has been submitted.',
icon: 'success',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
// Redirect to home.html after clicking 'OK'
window.location.href = 'home';
}
});
},
error: function (xhr, status, error) {
// Improved error handling
console.log('Error:', xhr.responseText, status, error);
alert('Error: ' + xhr.status + ' ' + xhr.statusText);
}
});
});
});
</script> </script>

4
src/main/resources/templates/checklistofficer/checklistofficer.html

@ -8,7 +8,9 @@
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>

Loading…
Cancel
Save