csrtechnew.ohctech.in/beneficiary_enquiry.php
2025-08-29 16:30:39 +05:30

582 lines
18 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) {}
</script>
<?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="#">Enquiry</li>
<li class="#">Beneficiary Enquiry</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div>
<form name="f1" method="post" id="flex_form_user" action="">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="user_id" id="flex_user_id" />
</form>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
function formatDate(dateStr) {
const dateParts = dateStr.split('-');
return `${dateParts[2]}-${dateParts[1]}-${dateParts[0]}`;
}
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'beneficiary_enquiry_script.php',
dataType: 'json',
colModel: [{
display: 'Actions',
name: '',
width: w * .10,
sortable: false,
align: 'center'
},
{
display: 'Sr',
name: 'count',
width: w * .05,
sortable: false,
align: 'center'
},
{
display: 'Date of Enquiry',
name: 'enquiry_date',
width: w * .07,
sortable: true,
align: 'left'
},
{
display: 'Beneficiary Name',
name: 'beneficiary_name',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Gender',
name: 'gender',
width: w * .05,
sortable: true,
align: 'center'
},
{
display: " Date of Birth ",
name: "dob",
width: w * .07,
sortable: true,
align: "left",
process: function(cell, row) {
const originalDate = $(cell).text();
$(cell).text(formatDate(originalDate));
}
},
{
display: 'Beneficiary No',
name: 'trainees_no',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Parents No',
name: 'perents_no',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Education',
name: 'education',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Course',
name: 'subject',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Batch Name',
name: 'batch_id',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Reference Form',
name: 'reference_from',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Beneficiary Status',
name: 'addmission_status',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Village',
name: 'address',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Taluka',
name: 'tehsil',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'District',
name: 'district',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'State',
name: 'village',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Date of Unenrollment',
name: 'unenroll_date',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Remarks',
name: 'remark',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: "Last Modified By",
name: "modified_by",
width: w * .1,
sortable: true,
align: "left"
},
],
buttons: [
{
name: 'Add',
bclass: 'add',
onpress: add
},
{
separator: true
},
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
name: 'Download Template',
bclass: 'print_excel',
onpress: download_template
},
{
separator: true
},
{
name: 'Upload Excel',
bclass: 'print_excel',
onpress: upload_excel
},
{
separator: true
}
],
searchitems: [{
display: 'Date of Enquiry',
name: 'enquiry_date',
},
{
display: 'Beneficiary Name',
name: 'beneficiary_name',
isdefault: true
},
{
display: 'Beneficiary No',
name: 'aadhar_phone',
},
{
display: 'Parents No',
name: 'perents_no',
},
{
display: 'Reference Form',
name: 'reference_from',
},
{
display: 'Status(enroll/BPE(interested))',
name: 'addmission_status',
},
],
sortname: "id",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 200, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
// width: w,
height: h,
singleSelect: true
});
});
function pdf() {
var gridOptions = $('#flex1')[0].p;
var qtype = gridOptions.qtype || '';
var query = gridOptions.query || '';
var form = $('<form>', {
action: 'beneficiary_enquiry_pdf.php',
method: 'POST',
target: '_blank'
}).append(
$('<input>', { type: 'hidden', name: 'qtype', value: qtype }),
$('<input>', { type: 'hidden', name: 'query', value: query })
);
$('body').append(form);
form.submit();
form.remove();
}
function excel() {
window.location = 'beneficiary_enquiry_excel.php';
}
function download_template() {
window.location = 'beneficiary_enquiry_upload_temp.php';
}
function upload_excel() {
window.location = 'upload_enquiry_excel.php';
}
function add() {
var today = new Date().toISOString().split('T')[0];
var group = $('input[name="ohc_type_check"]');
if (group.length > 1) {
group.each(function() {
$(this).attr("checked", false);
});
}
var group = $('input[name="user_role_check"]');
if (group.length > 1) {
group.each(function() {
$(this).attr("checked", false);
});
}
$("#enquiry_id").val("");
$(".save_button").show();
$("#patient_name").val("");
$("#gender").val("");
$("#program").val("");
$("#program").select2();
$("#batch").val("");
$("#batch").select2();
$("#address").val("");
$("#address").select2();
$("#village").val("");
$("#village").select2();
$("#district").val("");
$("#district").select2();
$("#tehsil").val("");
$("#tehsil").select2();
$("#dob").val("");
$("#trainees_no").val("");
$("#perents_no").val("");
$("#aadhar_phone").val("");
$("#education").val("");
$("#education").select2();
$('#addmission_status').empty().append('<option value="BPE" selected >Interested</option>');
$("#reference_from").val("");
$("#unenroll_date").val(today);
$("#reamrk").val("");
$('#modal-add-user').modal("show");
getUserPreference();
}
// function save_user() {
// $.ajax({
// url: 'save_beneficiary.php',
// type: "POST",
// data: $("#user_form").serialize(),
// success: function(data) {
// BootstrapDialog.alert('Enquiry Saved Successfully.');
// $("#flex1").flexReload();
// setTimeout(function() {
// location.reload();
// }, 3000);
// return;
// },
// error: function(data) {
// BootstrapDialog.alert('Error Saving User');
// return;
// }
// });
// $('.close').click();
// }
function delete_user(userId) {
$("#flex_user_id").val(userId);
BootstrapDialog.confirm('Are You Sure To Delete The Beneficiary Enquiry?', function(result) {
if (result) {
$.ajax({
url: 'delete_beneficiary_enquiry.php',
type: "POST",
data: $("#flex_form_user").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('Enquiry Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting Enquiry');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Enquiry');
return;
}
});
}
});
}
var user_id = "";
function open_user(userId, action) {
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
var group = $('input[name="ohc_type_check"]');
if (group.length > 1) {
group.each(function() {
$(this).attr("checked", false);
});
}
group = $('input[name="user_role_check"]');
if (group.length > 1) {
group.each(function() {
$(this).attr("checked", false);
});
}
$("#user_id").val("");
$("#emp_id").val("");
$("#user_password").val("");
$("#confirm_password").val("");
$("#user_email").val("");
$("#user_name").val("");
$("#user_role").val("");
$("#ohc_type").val("");
$("#landing_page").val("");
$("#program").val("");
$('#program').select2();
$("#address").val("");
$("#address").select2();
$.ajax({
url: 'select_beneficiary_enquiry.php?userId=' + userId + ' ',
type: 'POST',
success: function(data) {
//alert(data);
var data = $.parseJSON(data);
//alert(data);
console.log(data.village);
console.log(data.tehsil);
console.log(data.district);
user_id = data.id;
$("#enquiry_id").val(data.id);
$("#enquiry_date").val(data.enquiry_date);
$("#patient_name").val(data.beneficiary_name);
// $("#gender").val(data.gender);
var radios = document.querySelectorAll('input[name="gender"]');
// Loop through radio buttons and set the checked attribute
radios.forEach(function(radio) {
if (radio.value === data.gender) {
radio.checked = true;
}
});
// $("#village").val(data.village);
// $('#village').select2();
// set_state();
// $("#district").val(data.district);
// $('#district').select2();
// set_district();
// $("#tehsil").val(data.tehsil);
// $('#tehsil').select2();
// set_village();
// $("#address").val(data.address);
// $("#address").select2();
getAddress(data.address);
$("#dob").val(data.dob);
$("#doe").val(data.enquiry_date);
$("#unenroll_date").val(data.unenroll_date);
$("#trainees_no").val(data.trainees_no);
$("#perents_no").val(data.perents_no);
$("#aadhar_phone").val(data.aadhar_phone);
$("#education").val(data.education);
$('#education').select2();
// if (data.addmission_status === 'not-interested') {
// $('#addmission_status').on('select2:opening', function(e) {
// e.preventDefault(); // Prevent the dropdown from opening
// });
// } else {
// $('#addmission_status').off('select2:opening'); // Allow normal behavior for other values
// }
if (data.addmission_status == 'enroll') {
$('#addmission_status').empty().append('<option value="enroll" selected >Enrolled</option>');
}
if (data.addmission_status == 'BPE') {
$('#addmission_status').empty().append('<option value="BPE" selected >Interested</option><option value="not-interested" >Not Enrolled</option>');
}
if (data.addmission_status == 'not-interested') {
$('#addmission_status').empty().append('<option value="not-interested" selected >Not Enrolled</option><option value="BPE" >Interested</option>');
}
// $("#addmission_status").val(data.addmission_status);
// $('#addmission_status').select2();
$("#reference_from").val(data.reference_from);
if (data.subject != null) {
var subject = data.subject;
var dataarray = subject.split(",");
$("#program_name").val(dataarray);
$('#program_name').select2();
if (data.addmission_status == 'enroll') {
$('#program_name').prop('disabled', true);
}else{
$('#program_name').prop('disabled', false);
}
}
// $("#batch").val(data.batch_id);
// $('#batch').select2();
$('#modal-add-user').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating User');
return;
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/add_enquiry.php'); ?>