|
|
|
@ -591,98 +591,11 @@ body { |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Death certificate card --> |
|
|
|
|
|
|
|
<div class="card" id="death-card" style="display: none;"> |
|
|
|
<div class="card-header bg-dark text-white"> |
|
|
|
<h5>Death Certificate:-</h5> |
|
|
|
</div> |
|
|
|
<div class="card-body" > |
|
|
|
<h6> |
|
|
|
<strong>Death Certificate Details :-</strong> |
|
|
|
</h6> |
|
|
|
<hr /> |
|
|
|
|
|
|
|
<div class="container mt-5"> |
|
|
|
|
|
|
|
<!-- Row 1:Register No and Name --> |
|
|
|
<div class="row mb-3"> |
|
|
|
|
|
|
|
<div class="col-md-5"> |
|
|
|
<label class="form-label" for="registerno">Enter Register Number </label> <input type="text" |
|
|
|
class="form-control" |
|
|
|
placeholder="Enter Register number"> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-5"> |
|
|
|
<label class="form-label" for="name">Person Name </label> <input type="text" |
|
|
|
class="form-control" placeholder="Enter Person Name here" id="personname" oninput="this.value = this.value.replace(/[^a-zA-Z\s]/g, '')"> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Row 2: D.O.B and Gender --> |
|
|
|
<div class="row mb-3"> |
|
|
|
<div class="col-md-5"> |
|
|
|
<label class="form-label" for="name">Date of Death<span |
|
|
|
class="text-danger">*</span></label> <input type="DATE" |
|
|
|
class="form-control" placeholder="Select Date" |
|
|
|
id="dateofdeath" onclick="this.showPicker()" required> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-5"> <label class="form-label d-block">Gender <span class="text-danger">*</span></label> |
|
|
|
<div class="d-flex align-items-center gap-3"> |
|
|
|
<div class="form-check form-check-inline mb-0"> |
|
|
|
<input class="form-check-input" type="radio" name="deathgender" id="deathGenderMale" value="Male" required> <label class="form-check-label" for="deathGenderMale">Male</label> </div> |
|
|
|
<div class="form-check form-check-inline mb-0"> <input class="form-check-input" type="radio" name="deathgender" id="deathGenderFemale" value="Female" required> <label class="form-check-label" for="deathGenderFemale">Female</label> </div> |
|
|
|
<div class="form-check form-check-inline mb-0"> <input class="form-check-input" type="radio" name="deathgender" id="deathGenderTrans" value="Transgender" required> <label class="form-check-label" for="deathGenderTrans">Transgender</label> |
|
|
|
</div> </div> </div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Row 3: Parents Details --> |
|
|
|
<div class="row mb-3"> |
|
|
|
<div class="col-md-5"> |
|
|
|
<label class="form-label" for="name">Name of Father</label> <input type="text" |
|
|
|
class="form-control" placeholder="Enter the Father Name" |
|
|
|
id="deathfathername"> |
|
|
|
</div> |
|
|
|
<div class="col-md-5"> |
|
|
|
<label class="form-label" for="name">Name of Mother</label> <input type="text" |
|
|
|
class="form-control" placeholder="Enter the Mother Name" |
|
|
|
id="deathmothername"> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-5 mt-3"> |
|
|
|
<label for="death-captcha-input">Enter Captcha <span class="text-danger">*</span></label> |
|
|
|
<div class="d-flex align-items-center"> |
|
|
|
<div id="death-captcha" class="captcha-box mr-2" style="width: 140px; text-align: center; user-select: none;"></div> |
|
|
|
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="generateCaptcha('death')">↻</button> |
|
|
|
</div> |
|
|
|
<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> |
|
|
|
<div class="text-center "> |
|
|
|
<button type="button" class="btn btn-success" onclick="fetchDeathData()">Submit</button> |
|
|
|
|
|
|
|
<!-- <button type="button" class="btn btn-secondary" onclick="goBack()">Back</button> --> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<br> |
|
|
|
|
|
|
|
@ -703,9 +616,6 @@ body { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Bootstrap Modal --> |
|
|
|
@ -725,28 +635,7 @@ body { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Bootstrap Modal --> |
|
|
|
<div class="modal fade" id="deathModal" tabindex="-1" aria-labelledby="deathModalLabel" data-bs-backdrop="static" aria-hidden="true"> |
|
|
|
<div class="modal-dialog modal-xl modal-dialog-scrollable"> |
|
|
|
<div class="modal-content"> |
|
|
|
<div class="modal-header"> |
|
|
|
<h5 class="modal-title" id="deathModalLabel">Death Certificate Details</h5> |
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">×</button> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="modal-body" id="deathModalBody"> |
|
|
|
<!-- Table will be injected here --> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
|
|
|
|
|
|
@ -1204,128 +1093,12 @@ function fetchBirthData() { |
|
|
|
if (xhr.responseJSON && xhr.responseJSON.message) { |
|
|
|
message = xhr.responseJSON.message; |
|
|
|
} |
|
|
|
alert("Error: " + message); |
|
|
|
alert(message); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this function only using in live |
|
|
|
|
|
|
|
function fetchDeathData() { |
|
|
|
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); |
|
|
|
|
|
|
|
// 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) { |
|
|
|
Swal.fire({ |
|
|
|
icon: 'warning', |
|
|
|
title: 'Missing Gender Selection', |
|
|
|
text: 'Please select a gender.' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!validateCaptcha('death')) { |
|
|
|
//captchaInput.classList.add('is-invalid'); |
|
|
|
//captchaInput.focus(); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
captchaInput.classList.remove('is-invalid'); |
|
|
|
} |
|
|
|
|
|
|
|
const formattedDod = dod.split("-").reverse().join("/"); // Convert yyyy-MM-dd to dd/MM/yyyy |
|
|
|
|
|
|
|
// console.log("dod:", formattedDod); |
|
|
|
$('#pageLoader').show(); |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
url: '/crs/api/death-details', |
|
|
|
method: 'GET', |
|
|
|
data: { |
|
|
|
dod: formattedDod, |
|
|
|
sex: gender.charAt(0).toUpperCase() |
|
|
|
}, |
|
|
|
success: function (response) { |
|
|
|
$('#pageLoader').hide(); |
|
|
|
|
|
|
|
if (response && response.DEATH && response.DEATH.length > 0) { |
|
|
|
let html = '<table id="deathDataTable" class="table table-bordered"><thead><tr>' + |
|
|
|
'<th>S.No</th><th>Reg No</th><th>Person Name</th>' + |
|
|
|
'<th>Father Name</th><th>Mother Name</th><th>DOD</th><th>Certificate Link</th></tr></thead><tbody>'; |
|
|
|
|
|
|
|
response.DEATH.forEach((row ,index) => { |
|
|
|
html += `<tr> |
|
|
|
<td>${index + 1}</td> |
|
|
|
<td>${row.REGNO}</td> |
|
|
|
<td>${row.DEATHPERSONNAME}</td> |
|
|
|
<td>${row.FATHERNAME}</td> |
|
|
|
<td>${row.MOTHERNAME}</td> |
|
|
|
<td>${row.DOD}</td> |
|
|
|
<td>${row.ENGLISHURL ? `<a href="${row.ENGLISHURL}" target="_blank" |
|
|
|
onclick="saveCertificateLog('${row.REGNO}', '${row.DOD}', '${row.ENGLISHURL}', 'Death')">View</a>` : 'N/A'}</td> </tr>`; |
|
|
|
}); |
|
|
|
|
|
|
|
html += '</tbody></table>'; |
|
|
|
$('#deathModalBody').html(html); |
|
|
|
|
|
|
|
// Delay initialization to ensure DOM is ready |
|
|
|
setTimeout(() => { |
|
|
|
$('#deathDataTable').DataTable({ |
|
|
|
responsive: true, |
|
|
|
pagingType: "full_numbers", // Buttons for pagination |
|
|
|
language: { |
|
|
|
search: "🔍 Search: ", |
|
|
|
emptyTable: "No records found", |
|
|
|
paginate: { |
|
|
|
previous: "<button class='btn btn-outline-primary btn-sm'>Previous</button>", |
|
|
|
next: "<button class='btn btn-outline-primary btn-sm'>Next</button>" |
|
|
|
} |
|
|
|
}, |
|
|
|
columnDefs: [ |
|
|
|
{ orderable: false, targets: 0 } // Disable sorting on S.No |
|
|
|
] |
|
|
|
}); |
|
|
|
}, 100); |
|
|
|
} else { |
|
|
|
$('#deathModalBody').html('<p class="text-danger">No deathrecords found.</p>'); |
|
|
|
} |
|
|
|
|
|
|
|
const modal = new bootstrap.Modal(document.getElementById('deathModal')); |
|
|
|
modal.show(); |
|
|
|
}, |
|
|
|
error: function (xhr) { |
|
|
|
$('#pageLoader').hide(); |
|
|
|
let message = "Something went wrong."; |
|
|
|
if (xhr.responseJSON && xhr.responseJSON.message) { |
|
|
|
message = xhr.responseJSON.message; |
|
|
|
} |
|
|
|
alert("Error: " + message); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function saveCertificateLog(regNo, eventDate, url, service){ |
|
|
|
$.ajax({ |
|
|
|
url: '/crs/api/saveCertificateLogs', |
|
|
|
|