|
|
|
@ -10,11 +10,18 @@ |
|
|
|
<!-- Bootstrap CSS --> |
|
|
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Include Bootstrap Icons CDN in <head> if not already --> |
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"> |
|
|
|
|
|
|
|
<!-- <link th:href="@{/styles/birthanddeath.css}" rel="stylesheet" /> --> |
|
|
|
|
|
|
|
</head> |
|
|
|
|
|
|
|
|
|
|
|
<style> |
|
|
|
|
|
|
|
|
|
|
|
.form-check { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
@ -405,7 +412,7 @@ body { |
|
|
|
@media (min-width: 769px) { |
|
|
|
.mobile-username, |
|
|
|
.mobile-logout { |
|
|
|
display: none; |
|
|
|
display: block; |
|
|
|
} |
|
|
|
|
|
|
|
.header .center-text{ |
|
|
|
@ -417,7 +424,7 @@ body { |
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
</head> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<body style="background-color: #ebf1fa;"> |
|
|
|
@ -557,7 +564,7 @@ body { |
|
|
|
id="mothername"> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-5 mt-3"> |
|
|
|
<div class="col-md-5 mt-3"> |
|
|
|
<label for="birth-captcha-input">Enter Captcha <span class="text-danger">*</span></label> |
|
|
|
<div class="d-flex align-items-center"> |
|
|
|
<div id="birth-captcha" class="captcha-box mr-2" style="width: 140px; text-align: center; user-select: none;"></div> |
|
|
|
@ -566,7 +573,7 @@ body { |
|
|
|
<input type="text" id="birth-captcha-input" class="form-control mt-2" |
|
|
|
placeholder="Enter Captcha" |
|
|
|
onpaste="return false" oncopy="return false" oncut="return false" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
@ -660,7 +667,7 @@ body { |
|
|
|
<input type="text" id="death-captcha-input" class="form-control mt-2" |
|
|
|
placeholder="Enter Captcha" |
|
|
|
onpaste="return false" oncopy="return false" oncut="return false" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
@ -742,25 +749,26 @@ body { |
|
|
|
|
|
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
|
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|
|
|
|
|
|
|
<script |
|
|
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> |
|
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
|
|
<script |
|
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script> |
|
|
|
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> |
|
|
|
|
|
|
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> |
|
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Your custom script |
|
|
|
<script th:src="@{/script/birthanddeath.js}"></script> --> |
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
|
|
// Redirect after 60 seconds (1 minute) of inactivity |
|
|
|
// Redirect after 60 seconds (1 minute) of inactivity |
|
|
|
let timeoutDuration = 10 * 60 * 1000; // 60 seconds |
|
|
|
|
|
|
|
let timeout; |
|
|
|
@ -782,14 +790,14 @@ body { |
|
|
|
resetTimeout(); |
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
$('#birthModal, #deathModal').on('hidden.bs.modal', function () { |
|
|
|
window.location.reload(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
$(document).ready(function () { |
|
|
|
function resetFields(cardId) { |
|
|
|
// Clear all input fields inside the given card |
|
|
|
$(`#${cardId} input[type="text"], #${cardId} input[type="date"]`).val(''); |
|
|
|
@ -803,19 +811,19 @@ body { |
|
|
|
$('#death-link').on('click', function () { |
|
|
|
resetFields('death-card'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
const today = new Date().toISOString().split("T")[0]; // yyyy-mm-dd format |
|
|
|
document.getElementById("dateofbirth").setAttribute("max", today); |
|
|
|
document.getElementById("dateofdeath").setAttribute("max", today); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
const userName = localStorage.getItem("userName"); |
|
|
|
console.log("userName ",userName); |
|
|
|
//console.log("userName ",userName); |
|
|
|
|
|
|
|
|
|
|
|
if (userName) { |
|
|
|
@ -837,8 +845,7 @@ body { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#logoutBtn').click(function (e) { |
|
|
|
e.stopPropagation(); |
|
|
|
$('#logoutBtn,#logoutBtnMobile').click(function () { |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Are you sure?", |
|
|
|
@ -865,7 +872,7 @@ body { |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const links = document.querySelectorAll('.nav-link'); |
|
|
|
@ -876,29 +883,29 @@ body { |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/* card display script */ |
|
|
|
/* card display script */ |
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
const birthLink = document.getElementById("birth-link"); |
|
|
|
const deathLink = document.getElementById("death-link"); |
|
|
|
const birthCard = document.getElementById("birth-card"); |
|
|
|
const deathCard = document.getElementById("death-card"); |
|
|
|
const birthLink = document.getElementById("birth-link"); |
|
|
|
const deathLink = document.getElementById("death-link"); |
|
|
|
const birthCard = document.getElementById("birth-card"); |
|
|
|
const deathCard = document.getElementById("death-card"); |
|
|
|
|
|
|
|
function showCard(selectedLink, selectedCard, otherLink, otherCard) { |
|
|
|
function showCard(selectedLink, selectedCard, otherLink, otherCard) { |
|
|
|
selectedCard.style.display = "block"; |
|
|
|
otherCard.style.display = "none"; |
|
|
|
selectedLink.classList.add("active"); |
|
|
|
otherLink.classList.remove("active"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
birthLink.addEventListener("click", function () { |
|
|
|
birthLink.addEventListener("click", function () { |
|
|
|
showCard(birthLink, birthCard, deathLink, deathCard); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
deathLink.addEventListener("click", function () { |
|
|
|
deathLink.addEventListener("click", function () { |
|
|
|
showCard(deathLink, deathCard, birthLink, birthCard); |
|
|
|
}); |
|
|
|
}); |
|
|
|
////////////////////////////////////////////// |
|
|
|
}); |
|
|
|
}); |
|
|
|
////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
|
|
|
function generateCaptcha(type) { |
|
|
|
@ -922,7 +929,7 @@ function generateCaptcha(type) { |
|
|
|
element.style.padding = "5px"; |
|
|
|
element.style.userSelect = "none"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function validateCaptcha(type) { |
|
|
|
const generated = document.getElementById(`${type}-captcha`).textContent.trim(); |
|
|
|
@ -949,26 +956,26 @@ function validateCaptcha(type) { |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
document.addEventListener("DOMContentLoaded", function () { |
|
|
|
generateCaptcha("birth"); |
|
|
|
generateCaptcha("death"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fetchBirthData() { |
|
|
|
|
|
|
|
const dob = document.getElementById('dateofbirth').value; |
|
|
|
const gender = document.querySelector('input[name="gender"]:checked')?.value; |
|
|
|
const captchaInput = document.getElementById('birth-captcha-input'); |
|
|
|
const dob = document.getElementById('dateofbirth').value; |
|
|
|
const gender = document.querySelector('input[name="gender"]:checked')?.value; |
|
|
|
const captchaInput = document.getElementById('birth-captcha-input'); |
|
|
|
|
|
|
|
console.log("gender:", gender); |
|
|
|
//console.log("gender:", gender); |
|
|
|
|
|
|
|
// Validate Date of Birth |
|
|
|
// Validate Date of Birth |
|
|
|
if (!dob) { |
|
|
|
Swal.fire({ |
|
|
|
icon: 'warning', |
|
|
|
@ -988,21 +995,21 @@ function fetchBirthData() { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// CAPTCHA validation first |
|
|
|
// Validate CAPTCHA |
|
|
|
if (!validateCaptcha('birth')) { |
|
|
|
// CAPTCHA validation first |
|
|
|
// Validate CAPTCHA |
|
|
|
if (!validateCaptcha('birth')) { |
|
|
|
//captchaInput.classList.add('is-invalid'); |
|
|
|
//captchaInput.focus(); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
captchaInput.classList.remove('is-invalid'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const formattedDob = dob.split("-").reverse().join("/"); // Convert yyyy-MM-dd to dd/MM/yyyy |
|
|
|
console.log("dob:", formattedDob); |
|
|
|
$('#pageLoader').show(); |
|
|
|
const formattedDob = dob.split("-").reverse().join("/"); // Convert yyyy-MM-dd to dd/MM/yyyy |
|
|
|
//console.log("dob:", formattedDob); |
|
|
|
$('#pageLoader').show(); |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/crs/api/birth-details', |
|
|
|
method: 'GET', |
|
|
|
data: { |
|
|
|
@ -1077,54 +1084,54 @@ function fetchBirthData() { |
|
|
|
} |
|
|
|
alert("Error: " + message); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fetchDeathData() { |
|
|
|
const dod = document.getElementById('dateofdeath').value; |
|
|
|
const gender = document.querySelector('input[name="deathgender"]:checked')?.value; |
|
|
|
const captchaInput = document.getElementById('death-captcha-input'); |
|
|
|
const dod = document.getElementById('dateofdeath').value; |
|
|
|
const gender = document.querySelector('input[name="deathgender"]:checked')?.value; |
|
|
|
const captchaInput = document.getElementById('death-captcha-input'); |
|
|
|
|
|
|
|
console.log("gender:", gender); |
|
|
|
// console.log("gender:", gender); |
|
|
|
|
|
|
|
// Validate Date of Birth |
|
|
|
if (!dod) { |
|
|
|
// Validate Date of Birth |
|
|
|
if (!dod) { |
|
|
|
Swal.fire({ |
|
|
|
icon: 'warning', |
|
|
|
title: 'Missing Date of Birth', |
|
|
|
text: 'Please enter your Date of Birth.' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Validate Gender |
|
|
|
if (!gender) { |
|
|
|
// Validate Gender |
|
|
|
if (!gender) { |
|
|
|
Swal.fire({ |
|
|
|
icon: 'warning', |
|
|
|
title: 'Missing Gender Selection', |
|
|
|
text: 'Please select a gender.' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!validateCaptcha('death')) { |
|
|
|
if (!validateCaptcha('death')) { |
|
|
|
//captchaInput.classList.add('is-invalid'); |
|
|
|
//captchaInput.focus(); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
captchaInput.classList.remove('is-invalid'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const formattedDod = dod.split("-").reverse().join("/"); // Convert yyyy-MM-dd to dd/MM/yyyy |
|
|
|
const formattedDod = dod.split("-").reverse().join("/"); // Convert yyyy-MM-dd to dd/MM/yyyy |
|
|
|
|
|
|
|
console.log("dod:", formattedDod); |
|
|
|
$('#pageLoader').show(); |
|
|
|
// console.log("dod:", formattedDod); |
|
|
|
$('#pageLoader').show(); |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/crs/api/death-details', |
|
|
|
method: 'GET', |
|
|
|
data: { |
|
|
|
@ -1187,7 +1194,7 @@ function fetchDeathData() { |
|
|
|
} |
|
|
|
alert("Error: " + message); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -1195,7 +1202,7 @@ function fetchDeathData() { |
|
|
|
|
|
|
|
|
|
|
|
function saveCertificateLog(regNo, eventDate, url, service){ |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/crs/api/saveCertificateLogs', |
|
|
|
type: 'POST', |
|
|
|
data: { |
|
|
|
@ -1205,17 +1212,17 @@ function saveCertificateLog(regNo, eventDate, url, service){ |
|
|
|
service: service |
|
|
|
}, |
|
|
|
success: function() { |
|
|
|
console.log('View logged successfully'); |
|
|
|
//console.log('View logged successfully'); |
|
|
|
}, |
|
|
|
error: function(xhr, status, error) { |
|
|
|
console.error('Logging failed:', error); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
|
|
|
|
</html> |
|
|
|
|