2007 lines
116 KiB
PHP
2007 lines
116 KiB
PHP
<?php include('techsyn_header.php'); ?>
|
|
<!-- Main Content Container for side bar and body-->
|
|
<div class="main-container ace-save-state" id="main-container">
|
|
<script type="text/javascript">
|
|
try {
|
|
ace.settings.loadState('main-container')
|
|
} catch (e) {}
|
|
|
|
|
|
let otpSentTime; // Variable to store the OTP sent time
|
|
let timerInterval; // Variable to store the timer interval
|
|
|
|
function otpValidation(id, status) {
|
|
var patient_name = $('#patient_name').val();
|
|
if (patient_name == '') {
|
|
BootstrapDialog.alert('Please Enter Beneficiary name.!!!');
|
|
return false;
|
|
}
|
|
|
|
|
|
if ($('#aadhar_card').val().length != 0 || $('#aadhar_card').val() == '') {
|
|
if ($('#aadhar_card').val().length != 12) {
|
|
BootstrapDialog.alert('Please Enter 12 Digit Aadhar no.!!!');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if ($('#aadhar_phone').val().length != 0 || $('#aadhar_phone').val() == '') {
|
|
if ($('#aadhar_phone').val().length != 10) {
|
|
BootstrapDialog.alert('Please Enter 10 Digit Aadhar Linked Phone.!!!');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
sendOtp(id, status, patient_name);
|
|
}
|
|
|
|
function aadhardublication() {
|
|
const aadhar_card = $('#aadhar_card').val();
|
|
|
|
// Check if the Aadhar card number is valid
|
|
if (aadhar_card.length === 12) {
|
|
// Send AJAX request to check for duplicates
|
|
$.post('check_aadhar.php', {
|
|
aadhar_card: aadhar_card
|
|
})
|
|
.done(function(response) {
|
|
// Log the response for debugging
|
|
console.log('Response:', response);
|
|
|
|
// Check if the response is successful and has the expected properties
|
|
if (response.status === 'success' && response.id) {
|
|
BootstrapDialog.show({
|
|
title: 'Information',
|
|
message: 'Aadhar Number Is Already Registered. Do you want to edit the existing record?',
|
|
buttons: [{
|
|
label: 'No',
|
|
action: function(dialog) {
|
|
// Clear the Aadhar card input field
|
|
$('#aadhar_card').val('');
|
|
dialog.close(); // Close the dialog
|
|
}
|
|
}, {
|
|
label: 'Yes Edit',
|
|
action: function(dialog) {
|
|
// Redirect to the existing beneficiary form
|
|
window.location.href = 'beneficiary_form.php?id=' + response.id;
|
|
}
|
|
}]
|
|
});
|
|
return;
|
|
}
|
|
})
|
|
.fail(function(jqXHR, textStatus, errorThrown) {
|
|
// Handle AJAX error
|
|
BootstrapDialog.alert('AJAX request failed: ' + textStatus + ', ' + errorThrown);
|
|
});
|
|
}
|
|
}
|
|
|
|
function mobileNumberDuplication() {
|
|
const aadhar_phone = $('#aadhar_phone').val();
|
|
|
|
// Check if the mobile number is valid (10 digits)
|
|
if (aadhar_phone.length === 10 && /^\d+$/.test(aadhar_phone)) {
|
|
// Send AJAX request to check for duplicates
|
|
$.post('check_mobile.php', {
|
|
aadhar_phone: aadhar_phone
|
|
})
|
|
.done(function(response) {
|
|
// Log the response for debugging
|
|
console.log('Response:', response);
|
|
|
|
|
|
|
|
// Check if the response is successful and has the expected properties
|
|
if (response.status === 'success' && response.id) {
|
|
if (response.ohc_status) {
|
|
BootstrapDialog.show({
|
|
title: 'Information',
|
|
message: 'Mobile number is already registered in ' + response.ohc_name + '. Do you want to merge the existing record in our center?',
|
|
buttons: [{
|
|
label: 'No',
|
|
action: function(dialog) {
|
|
$('#aadhar_phone').val('');
|
|
dialog.close();
|
|
}
|
|
},
|
|
{
|
|
label: 'Yes Merge',
|
|
action: function(dialog) {
|
|
// Redirect to the existing beneficiary form
|
|
window.location.href = 'beneficiary_form.php?id=' + response.id + '&ohc_status=yes';
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
} else {
|
|
BootstrapDialog.show({
|
|
title: 'Information',
|
|
message: 'Mobile Number is already registered. Do you want to edit the existing record?',
|
|
buttons: [{
|
|
label: 'No',
|
|
action: function(dialog) {
|
|
// Clear the Aadhar phone input field
|
|
$('#aadhar_phone').val('');
|
|
dialog.close(); // Close the dialog
|
|
}
|
|
},
|
|
{
|
|
label: 'Yes Edit',
|
|
action: function(dialog) {
|
|
// Redirect to the existing beneficiary form
|
|
window.location.href = 'beneficiary_form.php?id=' + response.id;
|
|
}
|
|
}
|
|
]
|
|
});
|
|
}
|
|
}
|
|
})
|
|
.fail(function(jqXHR, textStatus, errorThrown) {
|
|
// Handle AJAX error
|
|
BootstrapDialog.alert('AJAX request failed: ' + textStatus + ', ' + errorThrown);
|
|
});
|
|
}
|
|
}
|
|
|
|
function licenseNumberDuplication() {
|
|
const license_no = $('#license_no').val();
|
|
|
|
// Check if the license number is valid (up to 10 digits)
|
|
if (license_no.length > 0 && license_no.length <= 10) {
|
|
// Send AJAX request to check for duplicates
|
|
$.post('check_license.php', {
|
|
license_no: license_no
|
|
})
|
|
.done(function(response) {
|
|
// Log the response for debugging
|
|
console.log('Response:', response);
|
|
|
|
|
|
// Check if the response indicates a duplicate license number
|
|
if (response.status === 'success' && response.id) {
|
|
BootstrapDialog.show({
|
|
title: 'Information',
|
|
message: 'This License Number already exists.Do you want to continue.',
|
|
buttons: [{
|
|
label: 'No',
|
|
action: function(dialog) {
|
|
// Clear the license number input field
|
|
$('#license_no').val('');
|
|
dialog.close(); // Close the dialog
|
|
}
|
|
},
|
|
{
|
|
label: 'Yes Continue',
|
|
action: function(dialog) {
|
|
dialog.close();
|
|
}
|
|
}
|
|
]
|
|
});
|
|
}
|
|
})
|
|
.fail(function(jqXHR, textStatus, errorThrown) {
|
|
// Handle AJAX error
|
|
BootstrapDialog.alert('AJAX request failed: ' + textStatus + ', ' + errorThrown);
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendOtp(id, status) {
|
|
const phone = $('#aadhar_phone').val();
|
|
const patient_name = $('#patient_name').val();
|
|
|
|
// Check if the phone number is valid
|
|
if (phone.length === 10 && /^[0-9]+$/.test(phone)) {
|
|
// Simulate sending OTP via AJAX
|
|
$.post('generate_otp.php', {
|
|
action: 'send_otp',
|
|
aadhar_phone: phone,
|
|
id: id,
|
|
patient_name: patient_name
|
|
}, function(response) {
|
|
try {
|
|
response = JSON.parse(response);
|
|
BootstrapDialog.alert(response.message); // Provide feedback to the user
|
|
|
|
if (response.status === 'success') {
|
|
$('#otpSection').show();
|
|
$('#sendOtpButton').prop('disabled', true).text('OTP Sent Successfully');
|
|
otpSentTime = Date.now(); // Store the current timestamp
|
|
startOtpExpiryTimer(20 * 60 * 1000, id); // Start timer for 2 minutes
|
|
$('#patient_id').val(response.id);
|
|
$('#emp_code').val(response.emp_code);
|
|
// alert(response.emp_code);
|
|
}
|
|
} catch (e) {
|
|
BootstrapDialog.alert('Error processing response. Please try again.');
|
|
console.error('Parsing error:', e);
|
|
}
|
|
}).fail(function() {
|
|
BootstrapDialog.alert('Failed to send OTP. Please try again later.');
|
|
});
|
|
} else {
|
|
BootstrapDialog.alert('Please enter a valid 10-digit phone number.');
|
|
}
|
|
}
|
|
|
|
function startOtpExpiryTimer(duration, id) {
|
|
let remainingTime = duration;
|
|
|
|
// Update the timer display
|
|
timerInterval = setInterval(() => {
|
|
if (remainingTime <= 0) {
|
|
clearInterval(timerInterval);
|
|
$('#otp_status').text('OTP Expired');
|
|
$('#sendOtpButton').prop('disabled', false).text('Resend OTP'); // Enable resend button
|
|
$('#otpSection').hide(); // Hide OTP section
|
|
|
|
$.ajax({
|
|
url: 'delete_otp.php',
|
|
type: "POST",
|
|
data: {
|
|
id: id
|
|
},
|
|
success: function(data) {
|
|
|
|
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Deleting Expired OTP');
|
|
return;
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Calculate minutes and seconds
|
|
const minutes = Math.floor((remainingTime % (1000 * 60 * 60)) / (1000 * 60));
|
|
const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000);
|
|
|
|
$('#timer').text(`${minutes}m ${seconds}s`);
|
|
|
|
|
|
if (remainingTime <= 60000) {
|
|
$('#timer').css('color', 'red');
|
|
} else if (remainingTime <= 120000) {
|
|
$('#timer').css('color', 'orange');
|
|
} else {
|
|
$('#timer').css('color', 'green');
|
|
}
|
|
remainingTime -= 1000; // Decrease remaining time by 1 second
|
|
}, 1000);
|
|
}
|
|
|
|
function verifyOtp(id) {
|
|
const otp = $('#otp').val();
|
|
const phone = $('#aadhar_phone').val();
|
|
const currentTime = Date.now();
|
|
const expiryTime = 20 * 60 * 1000; // 2 minutes in milliseconds
|
|
|
|
// Check if the OTP is 4 digits long and contains only numbers
|
|
if (otp.length === 4 && /^\d+$/.test(otp)) {
|
|
// Check if OTP has expired
|
|
if (otpSentTime && (currentTime - otpSentTime > expiryTime)) {
|
|
BootstrapDialog.alert('OTP has expired. Please request a new one.');
|
|
clearInterval(timerInterval); // Clear the timer
|
|
$('#otpSection').hide();
|
|
$('#verification_status').text('Verification Not Completed').css('color', 'red');
|
|
$('#sendOtpButton').prop('disabled', false).text('Resend OTP');
|
|
$('#otp').val('');
|
|
return;
|
|
}
|
|
|
|
// Simulate verifying OTP via AJAX
|
|
$.post('verification_otp.php', {
|
|
action: 'verify_otp',
|
|
otp: otp,
|
|
aadhar_phone: phone,
|
|
id: id,
|
|
}, function(response) {
|
|
try {
|
|
response = JSON.parse(response);
|
|
BootstrapDialog.alert(response.message); // Provide feedback to the user
|
|
|
|
// Optionally handle successful verification
|
|
if (response.status === 'success') {
|
|
$('#verification_status').text('').css('color', 'green');
|
|
$('#sendOtpButton').prop('disabled', true).text('Verification Completed');
|
|
$('#otpSection').hide();
|
|
$('#emp_code').val(response.emp_code);
|
|
|
|
|
|
clearInterval(timerInterval); // Clear the timer on successful verification
|
|
}
|
|
} catch (e) {
|
|
BootstrapDialog.alert('Error processing response. Please try again.');
|
|
console.error('Parsing error:', e);
|
|
$('#sendOtpButton').prop('disabled', false).text('OTP Sent Successfully');
|
|
}
|
|
}).fail(function() {
|
|
BootstrapDialog.alert('Failed to verify OTP. Please try again later.');
|
|
$('#verification_status').text('Verification Not Completed').css('color', 'red');
|
|
$('#sendOtpButton').prop('disabled', false).text('Send OTP');
|
|
$('#otpSection').hide();
|
|
});
|
|
} else {
|
|
BootstrapDialog.alert('Please enter a valid 4-digit OTP.');
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
.input-group {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.input-group input {
|
|
padding: 5px;
|
|
font-size: 1em;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.input-group span {
|
|
margin-right: 10px;
|
|
}
|
|
</style>
|
|
|
|
<?php include('techsyn_sidebar.php'); ?>
|
|
|
|
<!--breadcrumb-->
|
|
<div class="main-content">
|
|
<div class="main-content-inner">
|
|
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
|
|
<ul class="breadcrumb">
|
|
<li class="active">Beneficiary</li>
|
|
<li class="active">Add Beneficiary Info</li>
|
|
</ul>
|
|
</div>
|
|
<script>
|
|
var now = new Date();
|
|
var month = String(now.getMonth() + 1).padStart(2, '0'); // Months are zero-based
|
|
var day = String(now.getDate()).padStart(2, '0');
|
|
var year = String(now.getYear()).padStart(2, '0');
|
|
var currentDate = `${year}-${month}-${day}`;
|
|
</script>
|
|
<?php
|
|
$activation_date = date("Y-m-d");
|
|
|
|
$id = $_REQUEST['id'];
|
|
$ohc_status = $_REQUEST['ohc_status'];
|
|
$sqlSelect = "SELECT * FROM patient_master where id = '$id'";
|
|
$querySELECT = mysqli_query($conn, $sqlSelect);
|
|
$fetchCSR = mysqli_fetch_assoc($querySELECT);
|
|
if (is_array($fetchCSR)) {
|
|
extract($fetchCSR);
|
|
}
|
|
// error_log("check_name".$father_name)
|
|
$tahshil_name = getFieldFromTable('name', 'tehsils', 'id', $tehsil);
|
|
$district_name = getFieldFromTable('name', 'districts', 'id', $district);
|
|
error_log("check_tahshi : " . $tahshil_name);
|
|
?>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
var village = <?= json_encode($village) ?>;
|
|
if (village > 0) {
|
|
getAddress(village);
|
|
}
|
|
var dob = <?= json_encode($dob) ?>; // Assuming $dob is a valid date string
|
|
|
|
if (dob) {
|
|
// Make sure dob is in a valid format if necessary
|
|
calculateAndSetAge(dob);
|
|
}
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%;">
|
|
<form class="form-horizontal" id="employee_form" name="employee_form" enctype="multipart/form-data" action="#" method="post">
|
|
<input type="hidden" id="questionnaire_section_ids" name="questionnaire_section_ids[]">
|
|
<input type="hidden" name="flex_docs_id" id="flex_docs_id" />
|
|
|
|
<div class="tabbable">
|
|
<ul class="nav nav-tabs padding-18">
|
|
<li id="basic" class="active"><a data-toggle="tab" href="#edit-basic"> <i class="green ace-icon fa fa-user bigger-120"></i> Basic Info </a></li>
|
|
<?php if ($_SESSION['role_type'] == 'CSR') { ?>
|
|
<li id="basic" class=""><a data-toggle="tab" href="#details"> <i class="red ace-icon fa fa-edit bigger-120"></i> Details</a></li>
|
|
<?php } ?>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="box-header with-border"></div>
|
|
<div class="tab-content profile-edit-tab-content">
|
|
<div id="edit-basic" class="tab-pane in active">
|
|
<div id="user-profile-2">
|
|
<div class="box-body">
|
|
<input type="hidden" name="id" id="id" value="<?php echo $id ?>">
|
|
<input type="hidden" name="ohc_status" id="ohc_status" value="<?php
|
|
if ($ohc_status == 'yes') {
|
|
echo $ohc_status;
|
|
} else {
|
|
echo 'no';
|
|
}
|
|
?>">
|
|
<div class="row">
|
|
<!-- Profile Picture -->
|
|
<div class="col-xs-12 col-sm-2 center">
|
|
<span class="profile-picture">
|
|
<form method="post" enctype="multipart/form-data" id="uploadForm">
|
|
<label for="photoUpload">
|
|
<?php if (!empty($row['photo'])) { ?>
|
|
<img class="editable img-responsive"
|
|
id="avatarPreview"
|
|
src="data:<?php echo htmlspecialchars($row['image_type'], ENT_QUOTES, 'UTF-8'); ?>;base64,<?php echo base64_encode($row['photo']); ?>"
|
|
alt="Beneficiary Profile Picture"
|
|
style="cursor:pointer; display:block; width: 180px; height: 200px;" />
|
|
<?php } else { ?>
|
|
<img class="editable img-responsive"
|
|
id="avatarPreview"
|
|
src="beneficiary.png"
|
|
alt="Default Beneficiary Picture"
|
|
style="cursor:pointer; width: 120px; height: 120px;" />
|
|
<?php } ?>
|
|
</label>
|
|
|
|
<!-- Hidden file input -->
|
|
<input type="file" name="photo" id="photoUpload" accept="image/*" style="display:none;" onchange="previewImage(event)">
|
|
</form>
|
|
</span>
|
|
<div class="space space-4"></div>
|
|
</div>
|
|
|
|
<!-- Preview & Upload Script -->
|
|
<script>
|
|
function previewImage(event) {
|
|
const reader = new FileReader();
|
|
reader.onload = function() {
|
|
document.getElementById('avatarPreview').src = reader.result;
|
|
// Auto-submit form (optional)
|
|
// document.getElementById('uploadForm').submit();
|
|
};
|
|
reader.readAsDataURL(event.target.files[0]);
|
|
}
|
|
</script>
|
|
|
|
<!-- Personal Information -->
|
|
<div class="col-sm-10">
|
|
<!-- Basic Info -->
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="beneficiary_category">Beneficiary Category</label>
|
|
<div class="col-sm-10">
|
|
<input type="hidden" name="patient_id" id="patient_id" value="<?php echo $id; ?>">
|
|
<select class="form-control chosen-select"
|
|
multiple
|
|
name="beneficiary_category[]"
|
|
id="beneficiary_category"
|
|
data-placeholder="Select Beneficiary Category">
|
|
|
|
<?php
|
|
echo generateOptionForMultiple('beneficiary_category', 'category_name', 'id', $beneficiary_category, '');
|
|
error_log($beneficiary_category . "ddddddddd")
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="patient_name">Beneficiary Name <span style="color: red;">*</span></label>
|
|
<div class="col-sm-10">
|
|
<input class="form-control" style="text-transform: uppercase;" type="text" name="patient_name" id="patient_name" placeholder="Surname Mid Name Father Name " value="<?php echo $patient_name; ?>">
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-2 control-label no-padding-right" for="father_name">Father's/Husband Name<span style="color: red;">*</span></label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="text" name="father_name" id="father_name" placeholder="Father/Husband Name" value="<?php echo $father_name ?>">
|
|
</div> -->
|
|
<!-- <label class="col-sm-2 control-label no-padding-right" for="area_size">Area Size (Hectare)</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="number" id="area_size" name="area_size" maxlength="10" value="<?php echo $area_size ?>" placeholder="Enter Area Size">
|
|
</div> -->
|
|
|
|
<!-- </div> -->
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="dob">Age/Birth Date</label>
|
|
<div class="col-sm-4">
|
|
<div class="input-group">
|
|
<input type="date" id="dob" name="dob" class="form-control" value="<?php echo $dob; ?>" placeholder="Enter Date of Birth">
|
|
<span></span>
|
|
<input type="number" id="age" name="age" class="form-control" placeholder="Enter Age">
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('age').addEventListener('input', function() {
|
|
const age = parseInt(this.value, 10);
|
|
if (!isNaN(age) && age > 0) {
|
|
const currentDate = new Date();
|
|
const birthYear = currentDate.getFullYear() - age;
|
|
|
|
|
|
const dob = `${birthYear}-01-01`;
|
|
document.getElementById('dob').value = dob;
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="gender" style="vertical-align: top"> Gender</label>
|
|
<div class="col-sm-4" style="vertical-align: top">
|
|
<label class="inline"> <input name="gender" id="gender" type="radio" class="ace" value="M" <?php if ($gender == 'M' || empty($gender)) {
|
|
echo "checked";
|
|
} ?>>
|
|
<span class="lbl middle"> Male</span>
|
|
</label>
|
|
<label class="inline"> <input name="gender" id="gender" value="F" <?php if ($gender == 'F') {
|
|
echo "checked";
|
|
} ?> type="radio" class="ace"> <span class="lbl middle"> Female</span>
|
|
</label>
|
|
<label class="inline"> <input name="gender" id="gender" value="O" type="radio" <?php if ($gender == 'O') {
|
|
echo "checked";
|
|
} ?> class="ace">
|
|
<span class="lbl middle"> Others</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="disabilty">Any Disability</label>
|
|
<div class="col-sm-4">
|
|
<div class="radio-group">
|
|
<input id="disability_checkbox" type="checkbox" class="ace">
|
|
<span class="lbl middle"> Has Disability</span>
|
|
<input name="disabilty1" id="disabilty1" type="text" class="form-control hidden" value="<?php echo $disabilty ?>" placeholder="If Yes Enter Here">
|
|
</div>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="marital_status">Marital Status</label>
|
|
<div class="col-sm-4">
|
|
|
|
<select class="form-control" name="marital_status" id="marital_status" required>
|
|
<option value="">Select Marital Status</option>
|
|
<option value="Married" <?php echo ($marital_status == "Married") ? "selected" : ""; ?>>Married</option>
|
|
<option value="Unmarried" <?php echo ($marital_status == "Unmarried") ? "selected" : ""; ?>>Unmarried</option>
|
|
<option value="Widow" <?php echo ($marital_status == "Widow") ? "selected" : ""; ?>>Widow</option>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="caste">Category</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="caste" id="caste" required>
|
|
<option value="">Select Category</option>
|
|
<option value="SC" <?php echo ($caste == "SC") ? "selected" : ""; ?>>SC</option>
|
|
<option value="ST" <?php echo ($caste == "ST") ? "selected" : ""; ?>>ST</option>
|
|
<option value="OBC" <?php echo ($caste == "OBC") ? "selected" : ""; ?>>OBC</option>
|
|
<option value="General" <?php echo ($caste == "General") ? "selected" : ""; ?>>General</option>
|
|
</select>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="religen">Religion</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control select2" name="religen" id="religen" required>
|
|
<option value="">Select Religion</option>
|
|
<option value="Hinduism" <?php echo ($religen == "Hinduism") ? "selected" : ""; ?>>Hinduism</option>
|
|
<option value="Islam" <?php echo ($religen == "Islam") ? "selected" : ""; ?>>Islam</option>
|
|
<option value="Sikhism" <?php echo ($religen == "Sikhism") ? "selected" : ""; ?>>Sikhism</option>
|
|
<option value="Baha'l" <?php echo ($religen == "Baha'l") ? "selected" : ""; ?>>Baha</option>
|
|
<option value="Confucianism" <?php echo ($religen == "Confucianism") ? "selected" : ""; ?>>Confucianism</option>
|
|
<option value="Polytheism" <?php echo ($religen == "Polytheism") ? "selected" : ""; ?>>Polytheism</option>
|
|
<option value="Jainism" <?php echo ($religen == "Jainism") ? "selected" : ""; ?>>Jainism</option>
|
|
<option value="Taoism" <?php echo ($religen == "Taoism") ? "selected" : ""; ?>>Taoism</option>
|
|
<option value="Judaism" <?php echo ($religen == "Judaism") ? "selected" : ""; ?>>Judaism</option>
|
|
<option value="Shinto" <?php echo ($religen == "Shinto") ? "selected" : ""; ?>>Shinto</option>
|
|
<option value="Buddhism" <?php echo ($religen == "Buddhism") ? "selected" : ""; ?>>Buddhism</option>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="economic_category">Ration Cards Type</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="economic_category" id="economic_category" required>
|
|
<option value="">Select Ration Cards</option>
|
|
<option value="APL" <?php echo ($economic_category == "APL") ? "selected" : ""; ?>>APL</option>
|
|
<option value="BPL" <?php echo ($economic_category == "BPL") ? "selected" : ""; ?>>BPL</option>
|
|
</select>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right" for="rc_number">Ration Cards Number</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="text" id="rc_number" name="rc_number" value="<?php echo $rc_number ?>" placeholder="Enter Ration Card Number">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="aadhar_card">Aadhar Card Number<span style="color: red;">*</span></label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="number" id="aadhar_card" name="aadhar_card" maxlength="12" value="<?php echo $aadhar_card ?>" oninput="aadhardublication();" placeholder="Enter Aadhar Card Number">
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="annual_income">Annual Income</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="annual_income" id="annual_income" required>
|
|
<option value="">Select Annual Income</option>
|
|
<option value="Up to 19,999" <?php echo ($annual_income == "Up to 19,999") ? "selected" : ""; ?>>Up to ₹19,999</option>
|
|
<option value="20,000 to 49,999" <?php echo ($annual_income == "20,000 to 49,999") ? "selected" : ""; ?>>₹20,000 to ₹49,999</option>
|
|
<option value="50,000 and above" <?php echo ($annual_income == "50,000 and above") ? "selected" : ""; ?>>₹50,000 and above</option>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="aadhar_card">Phone Number<span style="color: red;"></span></label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="tel" id="primary_phone" name="primary_phone" maxlength="10" value="<?php echo $primary_phone ?>" placeholder="Enter Phone Numbar">
|
|
</div>
|
|
|
|
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="email">Email</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="email" id="email" name="email" value="<?php echo $email_id ?>" placeholder="Enter Email..">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
|
|
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="primary_phone">Beneficiary Code</label>
|
|
<div class="col-sm-4">
|
|
<div class="input-group">
|
|
<input class="form-control" type="text" readonly id="emp_code" name="emp_code" value="<?php if ($emp_code != '' && $emp_code != null) {
|
|
echo $emp_code;
|
|
} else {
|
|
echo getBanificiaryCode();
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="pending_status">Status</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="status" id="status">
|
|
<option value="Pending" <?= $addmission_status == 'Pending' ? 'selected' : '' ?>>Pending</option>
|
|
<option value="Done" <?= $addmission_status == 'Done' ? 'selected' : '' ?>>Done</option>
|
|
<option value="In-Progress" <?= $addmission_status == 'In-Progress' ? 'selected' : '' ?>>In-Progress</option>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="dob">Activation Date</label>
|
|
<div class="col-sm-4">
|
|
<div class="input-group">
|
|
<input type="date" id="activation_date" name="activation_date" class="form-control"
|
|
value="<?php echo date('Y-m-d', strtotime($activation_date)); ?>"
|
|
placeholder="Enter Activation Date">
|
|
</div>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="pending_status">Activation Status</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="pending_status" id="pending_status">
|
|
<option value="">Select Status</option>
|
|
<option value="Pending" <?php echo ($pending_status == "Pending") ? "selected" : ""; ?>>Pending</option>
|
|
<option value="Active" <?php echo ($pending_status == "Active") ? "selected" : ""; ?>>Active</option>
|
|
<option value="Disable" <?php echo ($pending_status == "Disable") ? "selected" : ""; ?>>Disable</option>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="row fisheries" style="display: none;">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">
|
|
Fisheries License Details<span style="color: red;">*</span>
|
|
</h5>
|
|
<div class="col-sm-10 col-sm-2"></div>
|
|
<div class="col-sm-10 col-sm-10">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="license_no">
|
|
<strong>License No.<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="number" id="license_no" name="license_no" maxlength="10"
|
|
value="<?php echo htmlspecialchars($license_no); ?>"
|
|
placeholder="Enter License Number" required>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="license_type">
|
|
<strong>License Type<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="license_type" id="license_type">
|
|
<option value="">Select License Type</option>
|
|
<option value="Fish Seller" <?php echo ($license_type == "Fish Seller") ? "selected" : ""; ?>>Fish Seller</option>
|
|
<option value="Pagadiya Fisherman" <?php echo ($license_type == "Pagadiya Fisherman") ? "selected" : ""; ?>>Pagadiya Fisherman</option>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="license_validity_from">
|
|
<strong>License Validity From Date<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="date" id="license_validity_from" name="license_validity_from"
|
|
value="<?php echo htmlspecialchars($license_validity_from); ?>" required>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="license_validity_to">
|
|
<strong>License Validity To Date<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="date" id="license_validity_to" name="license_validity_to"
|
|
value="<?php echo htmlspecialchars($license_validity_to); ?>" required>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="nfdp">
|
|
<strong>NFDP<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="nfdp" id="nfdp">
|
|
<option value="">Select Option</option>
|
|
<option value="Yes" <?php echo ($nfdp == "Yes") ? "selected" : ""; ?>>Yes</option>
|
|
<option value="No" <?php echo ($nfdp == "No") ? "selected" : ""; ?>>No</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group nfdp_reg_field" style="display: <?php echo ($nfdp == "Yes") ? "block" : "none"; ?>;">
|
|
<label class="col-sm-2 control-label no-padding-right" for="nfdp_reg_no">
|
|
<strong>NFDP Reg No.<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="text" id="nfdp_reg_no" name="nfdp_reg_no"
|
|
value="<?php echo htmlspecialchars($nfdp_reg_no); ?>" placeholder="Enter NFDP Registration No.">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="type_of_fishing">
|
|
<strong>Types Of Fishing<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="type_of_fishing" id="type_of_fishing">
|
|
<option value="">Select Option</option>
|
|
<option value="Khili Bandhan" <?php echo ($type_of_fishing == "Khili Bandhan") ? "selected" : ""; ?>>Khili Bandhan</option>
|
|
<option value="Khola" <?php echo ($type_of_fishing == "Khola") ? "selected" : ""; ?>>Khola</option>
|
|
<option value="Chhutak" <?php echo ($type_of_fishing == "Chhutak") ? "selected" : ""; ?>>Chhutak</option>
|
|
</select>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="type_of_fishing_eng">
|
|
<strong>Types Of Fishing Activity Engagement<span style="color: red;">*</span></strong>
|
|
</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" name="type_of_fishing_eng" id="type_of_fishing_eng">
|
|
<option value="">Select Option</option>
|
|
<option value="Part Time" <?php echo ($type_of_fishing_eng == "Part Time") ? "selected" : ""; ?>>Part Time</option>
|
|
<option value="Full Time" <?php echo ($type_of_fishing_eng == "Full Time") ? "selected" : ""; ?>>Full Time</option>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Function to check if the validity dates are correct
|
|
function checkDate() {
|
|
const fromDate = $('#license_validity_from').val();
|
|
const toDate = $('#license_validity_to').val();
|
|
|
|
// Check if both dates are selected
|
|
if (fromDate && toDate && fromDate > toDate) {
|
|
BootstrapDialog.alert("Please select valid license validity dates.");
|
|
$('#license_validity_from').val('');
|
|
$('#license_validity_to').val('');
|
|
}
|
|
}
|
|
|
|
// Attach the checkDate function to the change event of both date inputs
|
|
$('#license_validity_from').change(checkDate);
|
|
$('#license_validity_to').change(checkDate);
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
// Show fisheries details if the selected category is 13
|
|
function toggleFisheries() {
|
|
if ($('#beneficiary_category').val() == 13) {
|
|
$('.fisheries').show();
|
|
} else {
|
|
$('.fisheries').hide();
|
|
}
|
|
}
|
|
|
|
// Show NFDP registration field based on selection
|
|
function toggleNfdpRegField() {
|
|
if ($('#nfdp').val() == 'Yes') {
|
|
$('.nfdp_reg_field').show();
|
|
} else {
|
|
$('.nfdp_reg_field').hide();
|
|
}
|
|
}
|
|
|
|
// Initial checks
|
|
toggleFisheries();
|
|
toggleNfdpRegField();
|
|
|
|
// Change event listeners
|
|
$('#beneficiary_category').change(toggleFisheries);
|
|
$('#nfdp').change(toggleNfdpRegField);
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">Verification<span style="color: red;">*</span></h5>
|
|
<div class="col-sm-12">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label no-padding-right" for="aadhar_phone">
|
|
<strong>Aadhar Linked Phone<span style="color: red;">*</span></strong>
|
|
</label>
|
|
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="tel" id="aadhar_phone" name="aadhar_phone" maxlength="10" value="<?php echo htmlspecialchars($aadhar_phone); ?>" <?php if ($verification_status == 1) { ?> readonly <?php } ?> placeholder="Enter Aadhar Linked Phone Number" required>
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<button class="btn btn-success" id="sendOtpButton" type="button" onclick="otpValidation(<?= $_REQUEST['id'] ?? 0 ?>, '<?= $verification_status ?? 0 ?>');">Send OTP</button> <span style="font-size: 13px; font-weight: bold; color: red;" id="otp_status"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="otpSection" style="display: none;">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label no-padding-right" for="otp">OTP</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="tel" id="otp" name="otp" maxlength="4" placeholder="Enter OTP Number" required>
|
|
</div>
|
|
<div class="col-sm-2">
|
|
<button class="btn btn-success" id="verifyOtpButton" type="button" onclick="verifyOtp($('#patient_id').val(),<?= $verification_status ?? 0 ?>);">Verify OTP</button> <span style="font-size: 13px; font-weight: bold;" id="timer"></span>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="form-group" id="verification_status" style="text-align: center; font-weight: bold; font-size: 1.2em; color: orange;">
|
|
Verification Pending
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
|
|
<script>
|
|
if ('<?= $verification_status ?>') {
|
|
$('#verification_status').text('');
|
|
// $('#verification_status').css('color', 'green');
|
|
$('#sendOtpButton').prop('disabled', true).text('Verification Completed');
|
|
|
|
}
|
|
</script>
|
|
|
|
|
|
<!-- Address Information -->
|
|
<div class="row">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">Address<span style="color: red;">*</span></h5>
|
|
<div class="col-sm-10 col-sm-2"></div>
|
|
<div class="col-sm-10 col-sm-10">
|
|
<?php
|
|
// Assuming $conn is your database connection
|
|
$ohc_type_ids = $_SESSION['current_ohcttype'];
|
|
|
|
$village_query = "SELECT id, village, tehsil FROM village WHERE find_in_set($ohc_type_ids,ohc_type_id)";
|
|
|
|
$result = mysqli_query($conn, $village_query);
|
|
$options = '';
|
|
while ($vill = mysqli_fetch_assoc($result)) {
|
|
$tehsil = getFieldFromTable('name', 'tehsils', 'id', $vill['tehsil']);
|
|
$options .= '<option value="' . $vill['id'] . '">' . $vill['village'] . ' / ' . $tehsil . '</option>';
|
|
}
|
|
?>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="village">Residing Village</label>
|
|
<div class="col-sm-4">
|
|
|
|
<select class="form-control " id="village" name="village" onchange="getAddress(this.value)">
|
|
<?php echo $options; ?>
|
|
</select>
|
|
<!-- <input class="form-control" type="text" id="village" name="village" placeholder="Enter Village" value="<?= $village ?>"> -->
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right" for="tehsil">Taluka</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" id="tehsil" name="tehsil" onchange="set_village()">
|
|
<!-- <option value="<?= $tehsil ?>"><?php echo $tahshil_name ?></option> -->
|
|
<option value="">Select Option</option>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="district">District</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" id="district" name="district" onchange="set_district()">
|
|
<option value="">Select Option</option>
|
|
|
|
<!-- <option value="<?= $district ?>"><?php echo $district_name ?></option> -->
|
|
</select>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="state">State</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control" id="state" name="state" onchange="set_state()">
|
|
<option value="">Select State</option>
|
|
<?php echo generateOption('states', 'name', 'id', $state, ''); ?>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="pin_code">Pin Code</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="text" id="pin_code" name="pin_code" value="<?= $pin_code ?>" placeholder="Enter Pin Code">
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right" for="post">Street Location</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="text" id="post" name="post" value="<?= $post ?>" placeholder="Enter Post">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Qualification Details -->
|
|
<div class="row">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">Qualification Details<span style="color: red;">*</span></h5>
|
|
<div class="col-sm-10 col-sm-2"></div>
|
|
<div class="col-sm-10 col-sm-10">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="qualification">Qualification</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control form-control-lg" name="qualification" id="qualification" required>
|
|
<option value="">Select Qualification</option>
|
|
<?php echo generateOption('qualification_details', 'qualification_name', 'id', $qualification, ''); ?>
|
|
</select>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right" for="experience">Experience</label>
|
|
<div class="col-sm-4">
|
|
<input class="form-control" type="text" id="experience" name="experience" value="<?= $experience ?>" placeholder="Enter Experience">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Benefit Program Eligibility -->
|
|
<div class="row">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">
|
|
Benefit Program Eligibility<span style="color: red;">*</span>
|
|
</h5>
|
|
<div class="col-sm-10 col-sm-2"></div>
|
|
<div class="col-sm-10 col-sm-10">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right" for="benefit_program_eligibility">Benefit Program Eligibility</label>
|
|
<div class="col-sm-4">
|
|
<select onchange="setActivityOption();" class="form-control chosen-select" multiple name="benefit_program_eligibility[]" id="benefit_program_eligibility" data-placeholder="Select Program Eligibility">
|
|
<?php echo generateOption('csr_program', 'program_name', 'csr_id', $benefit_program_eligibility, ''); ?>
|
|
</select>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('.chosen-select').chosen({
|
|
no_results_text: "No results matched",
|
|
width: "100%"
|
|
});
|
|
});
|
|
</script>
|
|
<!-- <label class="col-sm-2 control-label no-padding-right" for="distribution_center">Distribution Center</label>
|
|
<select class="form-control chosen-select" name="distribution_center" id="distribution_center" data-placeholder="Enter Program Location">
|
|
<option value="">Select a Distribution Center</option>
|
|
<?php echo generateOptionWithWhereClause('ohc_type', 'ohc_type_name', 'ohc_type_id', $distribution_center, '', 'ohc_category', '"OHC"'); ?>
|
|
</select> -->
|
|
<label class="col-sm-2 control-label no-padding-right" for="activity">Activity</label>
|
|
<div class="col-sm-4">
|
|
<select class="chosen-select chosen-select" multiple id="activity" name="activity[]" data-placeholder="Select Activity" onchange="getParajhjhmters()">
|
|
<?php
|
|
if ($_SESSION['role_type'] == 'VTI') {
|
|
$vti_acti = getFieldFromTable('activity', 'csr_program', 'program_name', 'Vocational Skill Training Institute');
|
|
|
|
echo generate_options("SELECT * FROM program_master where program_id IN ($vti_acti)", $activity, 'program_id', 'program_name', '', '');
|
|
} else {
|
|
echo generateOptionForMultiple('program_master', 'program_name', 'program_id', $activity, '', 'program_status', '"Active"');
|
|
}
|
|
|
|
?>
|
|
</select>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function setActivityOption() {
|
|
var program = $('#benefit_program_eligibility').val();
|
|
|
|
$.ajax({
|
|
url: 'generate_activity_option.php',
|
|
type: 'POST',
|
|
data: {
|
|
program_value: program
|
|
},
|
|
beforeSend: function() {
|
|
$('#activity').empty().append('<option value="">Loading activities...</option>');
|
|
},
|
|
success: function(response) {
|
|
$('#activity').empty();
|
|
$('#activity').append(response);
|
|
$('#activity').trigger('chosen:updated');
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.log('Error: ' + error + '\nStatus: ' + status + '\nResponse: ' + xhr.responseText);
|
|
$('#activity').empty().append('<option value="">Error loading activities. Please try again.</option>');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function getParamters() {
|
|
var activity = $('#activity').val();
|
|
var bnid = $('#bene_detail_id').val();
|
|
$.ajax({
|
|
url: 'beneficiary_fetch_parameters.php',
|
|
type: 'POST',
|
|
data: {
|
|
program_value: activity,
|
|
bnid: bnid
|
|
},
|
|
success: function(response) {
|
|
$('#dynamic_form_content').html(response);
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.log('Please Check Details!');
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
</script>
|
|
<div class="row">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">
|
|
Details<span style="color: red;">*</span>
|
|
</h5>
|
|
<div class="col-sm-10 col-sm-2"></div>
|
|
<div class="col-sm-10 col-sm-10" id="dynamic_form_content">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- <div class="row">
|
|
<h5 class="header blue bolder smaller" style="margin: 10px 20px;">
|
|
Details<span style="color: red;">*</span>
|
|
</h5>
|
|
<div class="col-sm-10 col-sm-2"></div>
|
|
<div class="col-sm-10 col-sm-10">
|
|
<?php
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$programValue = isset($_POST['program_value']) ? $_POST['program_value'] : null;
|
|
|
|
// Convert to array and sanitize
|
|
$idsArray = explode(',', $programValue);
|
|
$idsArray = array_map('intval', $idsArray); // Sanitize input
|
|
$idsList = implode(',', $idsArray); // Prepare a comma-separated list
|
|
}
|
|
|
|
$counter = 0;
|
|
$parameters_key = mysqli_query($conn, "SELECT * FROM key_health_reportable_parameter_master");
|
|
|
|
while ($row_key = mysqli_fetch_assoc($parameters_key)) {
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$programValue = isset($_POST['program_value']) ? $_POST['program_value'] : null;
|
|
}
|
|
$parameters = mysqli_query($conn, "SELECT * FROM beneficiary_checkup_parameter WHERE key_health_map_name='" . $row_key["key_param_id"] . " AND activity IN ($programValue)' LIMIT 1");
|
|
|
|
|
|
while ($row = mysqli_fetch_assoc($parameters)) {
|
|
$inputType = $row['input_type']; // Input type like text, textarea, select
|
|
$columnName = $row_key['key_param_id']; // Field name
|
|
$label = $row_key['key_param_name']; // Label name
|
|
?>
|
|
<?php
|
|
$counter++;
|
|
if ($counter % 2 == 0) {
|
|
echo '<div class="form-group">';
|
|
}
|
|
?>
|
|
<label class="col-sm-2 control-label no-padding-right" for="<?= $columnName ?>"><?= $label ?></label>
|
|
|
|
<?php if ($inputType == 'text') { ?>
|
|
<div class="col-sm-4">
|
|
|
|
<input type="text" name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control" value="<?= isset($paramData[$columnName]) ? htmlspecialchars($paramData[$columnName], ENT_QUOTES) : '' ?>">
|
|
</div>
|
|
<?php } elseif ($inputType == 'textarea') { ?>
|
|
<div class="col-sm-4">
|
|
|
|
<textarea name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control"><?= isset($paramData[$columnName]) ? htmlspecialchars($paramData[$columnName], ENT_QUOTES) : '' ?></textarea>
|
|
</div>
|
|
<?php } elseif ($inputType == 'select') {
|
|
$parameterValueIds = $row['parameter_value']; // Comma-separated IDs
|
|
$idsArray = explode(',', $parameterValueIds); // Convert to array
|
|
$idsList = implode(',', array_map('intval', $idsArray)); // Sanitize and prepare list of IDs
|
|
$paramValues = mysqli_query($conn, "SELECT parameter_value_id, parameter_value_name FROM checkup_parameter_value WHERE parameter_value_id IN ($idsList)");
|
|
?>
|
|
<div class="col-sm-4">
|
|
|
|
<select name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control select2">
|
|
<?php while ($option = mysqli_fetch_assoc($paramValues)): ?>
|
|
<option value="<?= $option['parameter_value_id'] ?>" <?= (isset($paramData[$columnName]) && $paramData[$columnName] == $option['parameter_value_id']) ? 'selected' : '' ?>>
|
|
<?= $option['parameter_value_name'] ?>
|
|
</option>
|
|
<?php endwhile; ?>
|
|
</select>
|
|
</div>
|
|
<?php } elseif ($inputType == 'number') { ?>
|
|
<div class="col-sm-4">
|
|
|
|
<input type="number" name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control" value="<?= isset($paramData[$columnName]) ? htmlspecialchars($paramData[$columnName], ENT_QUOTES) : '' ?>">
|
|
</div>
|
|
<?php } ?>
|
|
<?php
|
|
if ($counter % 2 == 0) {
|
|
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
// Close the row after two fields (col-sm-6 + col-sm-6 = 12)
|
|
// $counter++;
|
|
// if ($counter % 2 == 0) {
|
|
// echo '</div><div class="row">';
|
|
// }
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
-->
|
|
|
|
|
|
|
|
|
|
<!-- Form Buttons -->
|
|
<div class="box-footer" style="text-align: center;">
|
|
<?php if ($_REQUEST['id'] == '' || $_REQUEST['id'] == null) { ?>
|
|
<button class="btn btn-success new_button" id="new_button" type="reset" onclick="show_save_button();">
|
|
<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
|
|
New
|
|
</button>
|
|
<?php } ?>
|
|
<button class="btn btn-info save_button" id="save_button" type="button" onclick="validate();">
|
|
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
|
|
Save
|
|
</button>
|
|
<button class="btn btn-warning" type="reset">
|
|
<i class="ace-icon fa fa-undo bigger-110"></i>
|
|
Reset
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="details" class="tab-pane">
|
|
|
|
|
|
|
|
<?php
|
|
$bene_detail_id = $_REQUEST['id'];
|
|
error_log('jiji' . $bene_detail_id);
|
|
|
|
|
|
// Check if bene_detail_id is set
|
|
if ($bene_detail_id) {
|
|
// Fetch Beneficiary Details
|
|
$sql_pri = "SELECT * FROM beneficiary_add_details WHERE id = $bene_detail_id";
|
|
error_log($sql_pri);
|
|
$beneDetails = mysqli_query($conn, $sql_pri);
|
|
$beneData = mysqli_fetch_assoc($beneDetails);
|
|
|
|
// Fetch Checkup Parameters and their values
|
|
$sql_child = "SELECT * FROM beneficiary_form_key_value WHERE bene_detail_id = $bene_detail_id";
|
|
error_log($sql_child);
|
|
$paramValues = mysqli_query($conn, $sql_child);
|
|
$paramData = [];
|
|
while ($param = mysqli_fetch_assoc($paramValues)) {
|
|
$paramData[$param['bene_form_key']] = $param['checkup_form_value'];
|
|
}
|
|
}
|
|
|
|
|
|
// Fetch Beneficiary Data
|
|
$beneficiaries = mysqli_query($conn, "SELECT id, patient_name FROM patient_master");
|
|
|
|
// Fetch Program Data
|
|
$programs = mysqli_query($conn, "SELECT csr_id, program_name FROM csr_program");
|
|
$parameters_key = mysqli_query($conn, "SELECT * FROM key_health_reportable_parameter_master ");
|
|
// Fetch Dynamic Fields from checkup_parameter table
|
|
|
|
?>
|
|
|
|
<!--breadcrumb-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Beneficiary Select -->
|
|
|
|
|
|
<input type="hidden" name="bene_detail_id" id="bene_detail_id" value="<?= $bene_detail_id ?>">
|
|
<input type="hidden" name="beneficiary" id="beneficiary" value="<?= $bene_detail_id ?>">
|
|
|
|
|
|
|
|
<!-- Program Select -->
|
|
<!-- <div class="row">
|
|
<div class="col-sm-6">
|
|
|
|
<div class="form-group">
|
|
<label for="program">Program</label>
|
|
<select name="program" id="program" class="form-control select2">
|
|
<?php while ($row = mysqli_fetch_assoc($programs)): ?>
|
|
<option value="<?= $row['csr_id'] ?>" <?= (isset($beneData) && $beneData['program'] == $row['csr_id']) ? 'selected' : '' ?>>
|
|
<?= $row['program_name'] ?>
|
|
</option>
|
|
<?php endwhile; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<div class="form-group">
|
|
<label for="program">activity</label>
|
|
<select name="activity" id="activity" class="form-control select2">
|
|
<?php echo generateOptionWithWhereClause('program_master', 'program_name', 'program_id', $activity_name, '', 'program_status', '"Active"') ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
<!-- Dynamic Fields -->
|
|
<div class="row">
|
|
<?php
|
|
|
|
$counter = 0;
|
|
$parameters_key = mysqli_query($conn, "SELECT * FROM key_health_reportable_parameter_master ");
|
|
while ($row_key = mysqli_fetch_assoc($parameters_key)) {
|
|
$parameters = mysqli_query($conn, "SELECT * FROM checkup_parameter where key_health_map_name='" . $row_key["key_param_id"] . "' Limit 1 ");
|
|
while ($row = mysqli_fetch_assoc($parameters)) {
|
|
$inputType = $row['input_type']; // Input type like text, textarea, select
|
|
$columnName = $row_key['key_param_id']; // Field name
|
|
$placeHolder = '';
|
|
// $placeHolder = $row['place_holder_name']; // Placeholder text
|
|
$label = $row_key['key_param_name']; // Label name
|
|
?>
|
|
|
|
<div class="col-sm-6">
|
|
<div class="form-group">
|
|
<label for="<?= $columnName ?>"><?= $label ?></label>
|
|
|
|
<?php if ($inputType == 'text') { ?>
|
|
<input type="text" name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control" placeholder="<?= $placeHolder ?>" value="<?= isset($paramData[$columnName]) ? htmlspecialchars($paramData[$columnName], ENT_QUOTES) : '' ?>">
|
|
|
|
<?php } else if ($inputType == 'textarea') { ?>
|
|
<textarea name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control" placeholder="<?= $placeHolder ?>"><?= isset($paramData[$columnName]) ? htmlspecialchars($paramData[$columnName], ENT_QUOTES) : '' ?></textarea>
|
|
|
|
<?php } else if ($inputType == 'select') { ?>
|
|
<?php
|
|
// Fetch comma-separated IDs from the checkup_parameter table
|
|
$parameterValueIds = $row['parameter_value']; // Comma-separated IDs
|
|
$idsArray = explode(',', $parameterValueIds); // Convert to array
|
|
|
|
// Prepare the SQL query to fetch parameter values based on the IDs
|
|
$idsList = implode(',', array_map('intval', $idsArray)); // Sanitize and prepare list of IDs
|
|
$paramValues = mysqli_query($conn, "SELECT parameter_value_id, parameter_value_name FROM checkup_parameter_value WHERE parameter_value_id IN ($idsList)");
|
|
?>
|
|
<select name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control select2">
|
|
<?php while ($option = mysqli_fetch_assoc($paramValues)): ?>
|
|
<option value="<?= $option['parameter_value_id'] ?>" <?= (isset($paramData[$columnName]) && $paramData[$columnName] == $option['parameter_value_id']) ? 'selected' : '' ?>>
|
|
<?= $option['parameter_value_name'] ?>
|
|
</option>
|
|
<?php endwhile; ?>
|
|
</select>
|
|
|
|
<?php } elseif ($inputType == 'number') { ?>
|
|
<input type="number" name="<?= $columnName ?>" id="<?= $columnName ?>" class="form-control" placeholder="<?= $placeHolder ?>" value="<?= isset($paramData[$columnName]) ? htmlspecialchars($paramData[$columnName], ENT_QUOTES) : '' ?>">
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
// Close the row after two fields (col-sm-6 + col-sm-6 = 12)
|
|
$counter++;
|
|
if ($counter % 2 == 0) {
|
|
echo '</div><div class="row">';
|
|
}
|
|
?>
|
|
<?php }
|
|
} ?>
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
<button class="btn btn-primary" type="button" onclick="validate('')">
|
|
<i class="ace-icon fa fa-save"></i> Save
|
|
</button>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php if (isset($_REQUEST['flex_procurement_id'])) { ?>
|
|
<?php include('upload_bill.php'); ?>
|
|
<?php include('image_popup_procurement.php'); ?>
|
|
<?php } ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
function getAddress(village_id) {
|
|
$('#state').val('').select2();
|
|
$('#district').val('').select2();
|
|
$('#tehsil').val('').select2();
|
|
$('#village').val('').select2();
|
|
$('#pin_code').val('');
|
|
|
|
|
|
|
|
$.ajax({
|
|
url: 'get_address.php', // Path to your PHP script
|
|
type: 'POST',
|
|
data: {
|
|
village_id: village_id // Send the village ID in the request
|
|
},
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
if (data.error) {
|
|
BootstrapDialog.alert(data.error); // Display error message if present
|
|
} else {
|
|
// Check if data fields are present before assigning them
|
|
if (data.state_id) {
|
|
$('#state').val(data.state_id).select2();
|
|
set_state();
|
|
}
|
|
if (data.district_id) {
|
|
$('#district').val(data.district_id).select2();
|
|
set_district();
|
|
}
|
|
if (data.tehsil_id) {
|
|
$('#tehsil').val(data.tehsil_id).select2();
|
|
set_village();
|
|
}
|
|
if (data.village_id) {
|
|
$('#village').val(data.village_id).select2();
|
|
}
|
|
if (data.pincode) {
|
|
$('#pin_code').val(data.pincode);
|
|
}
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
console.error("AJAX error: " + textStatus + ' : ' + errorThrown);
|
|
BootstrapDialog.alert("An error occurred while fetching address information."); // User-friendly alert
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Flexigrid and Export Forms -->
|
|
<div class="main-container ace-save-state" id="main-container">
|
|
<script type="text/javascript">
|
|
try {
|
|
ace.settings.loadState('main-container')
|
|
} catch (e) {}
|
|
</script>
|
|
|
|
<div class="main-content">
|
|
<div class="main-content-inner">
|
|
<div id="flexigridDiv" class="table-responsive">
|
|
<form name="f1" method="post" id="flex_hira_form" action="">
|
|
<div id="flex1" style="width:100%">
|
|
<input type="hidden" name="flex_hira_id" id="flex_hira_id" />
|
|
</div>
|
|
</form>
|
|
<form name="export_form" method="post" id="export_form" action="">
|
|
<input type="hidden" name="pdf_actions" id="pdf_actions" value="hira_pdf.php" />
|
|
<input type="hidden" name="excel_actions" id="excel_actions" value="hira_excel.php" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div><!-- /.main-content -->
|
|
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const disabilityCheckbox = document.getElementById('disability_checkbox');
|
|
const disabilityInput = document.getElementById('disabilty1');
|
|
const incheck = $('#disabilty1').val();
|
|
|
|
|
|
function toggleInput() {
|
|
if (disabilityCheckbox.checked) {
|
|
disabilityInput.classList.remove('hidden');
|
|
disabilityInput.disabled = false;
|
|
} else {
|
|
disabilityInput.classList.add('hidden');
|
|
disabilityInput.disabled = true;
|
|
}
|
|
|
|
if (incheck !== '') {
|
|
disabilityInput.classList.remove('hidden');
|
|
disabilityInput.disabled = false;
|
|
disabilityCheckbox.checked = true;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// Add event listener for checkbox change
|
|
disabilityCheckbox.addEventListener('change', toggleInput);
|
|
|
|
// Initial check in case the page is loaded with the checkbox pre-checked
|
|
toggleInput();
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- End of page-content -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function updatePlaceholder() {
|
|
var selectBox = document.getElementById("identity");
|
|
var selectedValue = selectBox.options[selectBox.selectedIndex].value;
|
|
var placeholderText = "Enter ";
|
|
|
|
switch (selectedValue) {
|
|
case "Ration Card":
|
|
placeholderText += "Ration Card Number";
|
|
break;
|
|
case "BPL Card":
|
|
placeholderText += "BPL Card Number";
|
|
break;
|
|
case "Aadhar Card":
|
|
placeholderText += "Aadhar Card Number";
|
|
break;
|
|
default:
|
|
placeholderText += "Identity Number";
|
|
break;
|
|
}
|
|
|
|
document.getElementById("identity").placeholder = placeholderText;
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
<script>
|
|
function calculateAndSetAge(dob) {
|
|
const today = new Date();
|
|
const birthDate = new Date(dob);
|
|
|
|
// Calculate age
|
|
let age = today.getFullYear() - birthDate.getFullYear();
|
|
const monthDifference = today.getMonth() - birthDate.getMonth();
|
|
if (monthDifference < 0 || (monthDifference === 0 && today.getDate() < birthDate.getDate())) {
|
|
age--;
|
|
}
|
|
|
|
// Set age in the age input field
|
|
document.getElementById('age').value = age;
|
|
}
|
|
|
|
// Event listener for DOB input change
|
|
document.getElementById('dob').addEventListener('input', function() {
|
|
const dob = this.value;
|
|
if (dob) {
|
|
calculateAndSetAge(dob);
|
|
}
|
|
});
|
|
|
|
// Check and set age on window load if DOB is available
|
|
window.onload = function() {
|
|
const dob = document.getElementById('dob').value;
|
|
if (dob) {
|
|
calculateAndSetAge(dob);
|
|
}
|
|
};
|
|
</script>
|
|
<script>
|
|
function set_village() {
|
|
var tehsilId = $('#tehsil').val();
|
|
var villages = <?php
|
|
$villages = [];
|
|
$ohc_type_ids = $_SESSION['current_ohcttype'];
|
|
$ohc_type = $_SESSION['role_type'];
|
|
|
|
if ($ohc_type == 'CSR') {
|
|
$query = "SELECT id, village, tehsil FROM village WHERE find_in_set($ohc_type_ids,ohc_type_id)";
|
|
} else {
|
|
$query = "SELECT id, village, tehsil FROM village";
|
|
}
|
|
error_log("Select_query_check : " . $query);
|
|
if ($result = $conn->query($query)) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$tehsil_name = getFieldFromTable('name', 'tehsils', 'id', $row['tehsil']);
|
|
$villages[$row['tehsil']][] = [
|
|
'id' => $row['id'],
|
|
'name' => $row['village'],
|
|
'tehsil_name' => $tehsil_name
|
|
];
|
|
}
|
|
}
|
|
echo json_encode($villages);
|
|
?>;
|
|
$('#village').empty().append('<option value="">Select Village</option>');
|
|
if (villages[tehsilId]) {
|
|
$.each(villages[tehsilId], function(index, village) {
|
|
$('#village').append('<option value="' + village.id + '">' + village.name + ' / ' + village.tehsil_name + '</option>');
|
|
});
|
|
} else {
|
|
BootstrapDialog.alert('No villages found for the selected tehsil.');
|
|
}
|
|
}
|
|
|
|
|
|
function set_state() {
|
|
// Get the selected state ID
|
|
var stateId = $('#state').val();
|
|
|
|
// Parse the PHP-generated JSON to a JavaScript object
|
|
var districts = <?php
|
|
$districts = [];
|
|
if ($result = $conn->query("SELECT id, name, state_id FROM districts")) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$districts[$row['state_id']][] = ['id' => $row['id'], 'name' => $row['name']];
|
|
}
|
|
}
|
|
echo json_encode($districts);
|
|
?>;
|
|
|
|
// Clear and populate the district dropdown
|
|
$('#district').empty().append('<option value="">Select District</option>');
|
|
|
|
// Check if there are districts for the selected state
|
|
if (districts[stateId]) {
|
|
$.each(districts[stateId], function(index, district) {
|
|
$('#district').append('<option value="' + district.id + '">' + district.name + '</option>');
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function set_district() {
|
|
// Get the selected district ID
|
|
var districtId = $('#district').val();
|
|
|
|
// Parse the PHP-generated JSON to a JavaScript object
|
|
var tehsils = <?php
|
|
$tehsils = [];
|
|
if ($result = $conn->query("SELECT id, name, district_id FROM tehsils")) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$tehsils[$row['district_id']][] = ['id' => $row['id'], 'name' => $row['name']];
|
|
}
|
|
}
|
|
echo json_encode($tehsils);
|
|
?>;
|
|
|
|
// Clear and populate the tehsil dropdown
|
|
$('#tehsil').empty().append('<option value="">Select Taluka</option>');
|
|
|
|
// Check if there are tehsils for the selected district
|
|
if (tehsils[districtId]) {
|
|
$.each(tehsils[districtId], function(index, tehsil) {
|
|
$('#tehsil').append('<option value="' + tehsil.id + '">' + tehsil.name + '</option>');
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function getUserPreference() {
|
|
|
|
$.ajax({
|
|
url: 'fetch_user_preference.php',
|
|
type: "POST",
|
|
|
|
success: function(data) {
|
|
var data = $.parseJSON(data);
|
|
getAddress(data.village);
|
|
|
|
// $("#village").val(data.village);
|
|
// $("#post").val(data.post);
|
|
|
|
// $("#state").val(data.state);
|
|
// set_state();
|
|
// $("#district").val(data.district);
|
|
// set_district();
|
|
|
|
$("#post").val(data.post);
|
|
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert(data.message);
|
|
return;
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Get the 'id' parameter from the PHP request and convert it to a JavaScript variable
|
|
var id = <?= json_encode($_REQUEST['id'] ?? null) ?>;
|
|
// Check if 'id' is not present
|
|
if (!id) {
|
|
getUserPreference();
|
|
}
|
|
});
|
|
</script>
|
|
|
|
|
|
<script>
|
|
function getLikelihoodValue(likelihood) {
|
|
switch (likelihood) {
|
|
case 'rare':
|
|
return 1;
|
|
case 'unlikely':
|
|
return 2;
|
|
case 'possible':
|
|
return 3;
|
|
case 'likely':
|
|
return 4;
|
|
case 'almost certain':
|
|
return 5;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function getSeverityValue(severity) {
|
|
switch (severity) {
|
|
case 'negligible':
|
|
return 1;
|
|
case 'minor':
|
|
return 2;
|
|
case 'moderate':
|
|
return 3;
|
|
case 'major':
|
|
return 4;
|
|
case 'catastrophic':
|
|
return 5;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function calculateRiskScore() {
|
|
var likelihood = $('#likelihood').val();
|
|
var severity = $('#severity').val();
|
|
|
|
var likelihoodValue = getLikelihoodValue(likelihood);
|
|
var severityValue = getSeverityValue(severity);
|
|
|
|
var riskScore = likelihoodValue * severityValue;
|
|
$('#risk_score').val(riskScore);
|
|
|
|
var riskLevel = getRiskLevel(riskScore);
|
|
$('#risk_level').val(riskLevel);
|
|
}
|
|
|
|
function getRiskLevel(riskScore) {
|
|
if (riskScore <= 5) return 'Low';
|
|
if (riskScore <= 10) return 'Moderate';
|
|
if (riskScore <= 15) return 'High';
|
|
return 'Very High';
|
|
}
|
|
|
|
function validate() {
|
|
var patient_name = $('#patient_name').val().trim();
|
|
if (patient_name === '') {
|
|
BootstrapDialog.alert('Please enter the beneficiary name.');
|
|
return false;
|
|
}
|
|
|
|
var beneficiary_category = $('#beneficiary_category').val() || [];
|
|
var aadhar_card = $('#aadhar_card').val().trim();
|
|
if (aadhar_card.length > 0 &&
|
|
aadhar_card.length !== 12 &&
|
|
!beneficiary_category.includes("16")) {
|
|
BootstrapDialog.alert('Please enter a valid 12-digit Aadhar number.');
|
|
return false;
|
|
}
|
|
|
|
var aadhar_phone = $('#aadhar_phone').val().trim();
|
|
if (aadhar_phone.length > 0 && aadhar_phone.length !== 10) {
|
|
BootstrapDialog.alert('Please enter a valid 10-digit Aadhar-linked phone number.');
|
|
return false;
|
|
}
|
|
if (aadhar_phone === '') {
|
|
BootstrapDialog.alert('Please enter Aadhar-linked phone number.');
|
|
return false;
|
|
}
|
|
|
|
if (beneficiary_category.includes("13")) {
|
|
var license_no = $('#license_no').val().trim();
|
|
if (license_no === '') {
|
|
BootstrapDialog.alert('Please enter a 10-digit License number.');
|
|
return false;
|
|
}
|
|
var license_type = $('#license_type').val().trim();
|
|
if (license_type === '') {
|
|
BootstrapDialog.alert('Please select License Type.');
|
|
return false;
|
|
}
|
|
var license_validity_from = $('#license_validity_from').val();
|
|
if (license_validity_from === '') {
|
|
BootstrapDialog.alert('Please select License validity from date.');
|
|
return false;
|
|
}
|
|
var license_validity_to = $('#license_validity_to').val();
|
|
if (license_validity_to === '') {
|
|
BootstrapDialog.alert('Please select License validity to date.');
|
|
return false;
|
|
}
|
|
var nfdp = $('#nfdp').val();
|
|
if (nfdp === '') {
|
|
BootstrapDialog.alert('Please select NFDP.');
|
|
return false;
|
|
}
|
|
if (nfdp === 'Yes') {
|
|
var nfdp_reg_no = $('#nfdp_reg_no').val().trim();
|
|
if (nfdp_reg_no === '') {
|
|
BootstrapDialog.alert('Please enter NFDP Reg No.');
|
|
return false;
|
|
}
|
|
}
|
|
var type_of_fishing = $('#type_of_fishing').val();
|
|
if (type_of_fishing === '') {
|
|
BootstrapDialog.alert('Please select Type of Fishing.');
|
|
return false;
|
|
}
|
|
var type_of_fishing_eng = $('#type_of_fishing_eng').val();
|
|
if (type_of_fishing_eng === '') {
|
|
BootstrapDialog.alert('Please select Type of Fishing Engagement.');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
save_beneficiary();
|
|
return true;
|
|
}
|
|
|
|
function save_beneficiary() {
|
|
$.ajax({
|
|
url: 'beneficiary_form_save.php',
|
|
type: 'POST',
|
|
data: $("#employee_form").serialize(),
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
|
|
if(data && data.patient_id) {
|
|
$('#patient_id').val(data.patient_id);
|
|
|
|
|
|
save_bene('NALT');
|
|
|
|
BootstrapDialog.show({
|
|
message: 'Beneficiary Saved Successfully.',
|
|
buttons: [{
|
|
label: 'OK',
|
|
action: function(dialogItself) {
|
|
dialogItself.close();
|
|
$('.close').click();
|
|
$("#flex1").flexReload();
|
|
window.location.href = 'beneficiary_main_form.php';
|
|
}
|
|
}]
|
|
});
|
|
} else {
|
|
BootstrapDialog.alert('Error: Patient ID not received from server');
|
|
}
|
|
return;
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.log("Error:", error);
|
|
BootstrapDialog.alert('Error Saving Beneficiary');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
|
|
function save_bene(alt) {
|
|
|
|
var formData = $("#employee_form").serialize();
|
|
console.log("Form Data:", formData);
|
|
console.log("Form Data Array:", $("#employee_form").serializeArray());
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'save_bene_param.php',
|
|
data: $("#employee_form").serialize(),
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
if (response.success) {
|
|
if (alt != 'NALT') {
|
|
BootstrapDialog.alert('Beneficiary Details Saved Successfully.', function() {
|
|
|
|
window.location.href = 'beneficiary_main_form.php';
|
|
});
|
|
}
|
|
} else {
|
|
BootstrapDialog.alert('Error in Saving Beneficiary Details: ' + response.error);
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
BootstrapDialog.alert('Error in Saving Beneficiary Details');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
getParamters()
|
|
</script>
|
|
|
|
<style>
|
|
#modal-add-hazard {
|
|
overflow-y: scroll;
|
|
}
|
|
</style>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<script type="text/javascript">
|
|
|
|
function parameter_celculuter() {
|
|
var ft = 0;
|
|
if ($('#area_hechter').val() < 1 && ($('#area_hechter').val() != '' && $('#area_hechter').val() != null)) {
|
|
ft = $('#area_hechter').val() * 120000 * $('#subsidy_rate').val();
|
|
} else if ($('#total_mis_cost').val() < 120000 && ($('#total_mis_cost').val() != '' && $('#total_mis_cost').val() != null)) {
|
|
ft = $('#total_mis_cost').val() * $('#subsidy_rate').val();
|
|
} else {
|
|
ft = 120000 * $('#subsidy_rate').val();
|
|
}
|
|
// alert(Math.round((ft/100),2));
|
|
$('#ghcl_ft_contribution').val(Math.round((ft / 100), 2));
|
|
$('#ghcl_ft_contribution').attr('readonly', 'readonly');
|
|
var ggrc = $('#ggrc_contribution').val();
|
|
var tmc = $('#total_mis_cost').val();
|
|
if (tmc != '' && tmc != null) {
|
|
$('#farmers_contribution').val(tmc - Math.round((ft / 100), 2) - (ggrc));
|
|
$('#farmers_contribution').attr('readonly', 'readonly');
|
|
}
|
|
$('#difference').val($('#amount').val() - $('#amountt_to_be_deposit').val());
|
|
$('#difference').attr('readonly', 'readonly');
|
|
}
|
|
parameter_celculuter()
|
|
</script>
|
|
<!-- bootstrap & fontawesome -->
|
|
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|
<!-- page specific plugin styles -->
|
|
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
|
|
<link rel="stylesheet" href="assets/css/chosen.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
|
|
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
|
|
<script src="assets/js/jquery-ui.custom.min.js"></script>
|
|
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
|
|
<script src="assets/js/chosen.jquery.min.js"></script>
|
|
<script src="assets/js/spinbox.min.js"></script>
|
|
<script src="assets/js/bootstrap-datepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-timepicker.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
|
|
<script src="assets/js/dataTables.buttons.min.js"></script>
|
|
<script src="assets/js/buttons.flash.min.js"></script>
|
|
<script src="assets/js/buttons.html5.min.js"></script>
|
|
<script src="assets/js/buttons.print.min.js"></script>
|
|
<script src="assets/js/buttons.colVis.min.js"></script>
|
|
<script src="assets/js/dataTables.select.min.js"></script>
|
|
|
|
<script src="assets/js/moment.min.js"></script>
|
|
<script src="assets/js/daterangepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
|
|
<script src="assets/js/jquery.knob.min.js"></script>
|
|
<script src="assets/js/autosize.min.js"></script>
|
|
<script src="assets/js/jquery.inputlimiter.min.js"></script>
|
|
<script src="assets/js/jquery.maskedinput.min.js"></script>
|
|
<script src="assets/js/bootstrap-tag.min.js"></script>
|
|
<script src="assets/js/ace-elements.min.js"></script>
|