csrtechnew.ohctech.in/checkup_tab_master.php
2025-04-14 13:28:09 +05:30

1106 lines
43 KiB
PHP

<?php include ('techsyn_header.php'); ?>
<?php include ('log_entry.php'); ?>
<link rel="stylesheet" href="assets/css/select2.min.css" />
<!-- 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="#">Data Setup</li>
<li class="#">Masters</li>
<li class="active">Checkup Tab Master
</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div class="box box-primary" align='center'
style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
<form id="checkup_tab_movement_form" method="post">
<!-- box-body-->
<div class="box-body" id="reload_amb " style="width:90%; ">
<div class="row">
<div class="col-sm-12">
<table id="myTable" class="table table-bordered order-list">
<thead>
<tr>
<th>Checkup Tab Name</th>
<th colspan="2">Checkup Tab Code</th>
<th>Tab Order</th>
<th>Tab Icon</th>
<!-- <th>Valid Duration(in months)</th>
<th>Cost</th> -->
</tr>
</thead>
<?php $i = 0;
$row = null;
if (isset($_REQUEST['flex_tab_id'])) {
$sql = "select * from checkup_tab_master where tab_id='" . $_REQUEST['flex_tab_id'] . "'";
$result = mysqli_query($conn, $sql);
$num_rows = mysqli_num_rows($result);
$row = mysqli_fetch_array($result);
}
do {
?>
<tbody>
<tr>
<td style="width:8%">
<input type="hidden" name="tab_id<?= $i ?>" id="tab_id<?= $i ?>"
value="<?= $row['tab_id'] ?>" />
<input type="text" name="tab_name<?= $i ?>"
value="<?= $row['tab_name'] ?>" id="tab_name<?= $i ?>"
class="form-control" />
</td>
<td style="width:8%" colspan="2">
<input type="text" name="tab_code<?= $i ?>" id="tab_code<?= $i ?>"
value="<?= $row['tab_code'] ?>" class="form-control" />
</td>
<td style="width:8%;">
<input type="number" name="tab_order<?= $i ?>"
id="tab_order<?= $i ?>" value="<?= $row['tab_order'] ?>"
class="form-control" />
</td>
<td style="width:8%;">
<input type="text" name="tab_icon<?= $i ?>"
id="tab_icon<?= $i ?>" value="<?= $row['tab_icon'] ?>"
class="form-control" />
</td>
<!-- <td style="width:8%;">
<input type="number" name="valid_duration<?= $i ?>"
id="valid_duration<?= $i ?>" value="<?= $row['valid_upto'] ?>"
class="form-control" />
</td> -->
<!-- <td style="width:8%">
<input type="number" name="cost<?= $i ?>" id="cost<?= $i ?>"
class="form-control" value="<?= $row['cost'] ?>">
</td> -->
</tr>
<?php
$i++;
} while ($row = mysqli_fetch_array($result)) //end of while
?>
<input type="hidden" name="count_items" id="count_items"
value="<?= $i ?>" />
<!-- <tr>
<td style="width:8%" colspan="6">CHECKUP FORM SECTIONS</td>
</tr> -->
</tbody>
<tfoot>
<tr colspan="3">
<td style="width:8%">
<div class="form-group col-sm-12">
<label for="">Checkup Form Sections</label>
<select name="checkup_form_section_ids[]"
id="checkup_form_section_ids" multiple="multiple"
style="width: 100%" class="form-control chosen-select">
<?php
$sql = "select * from checkup_form_section";
// echo generateOption('checkup_form_section', 'section_name', 'section_id', '', '');
echo generate_options($sql, '', 'section_id', 'section_name', '', '');
?>
</select>
</div>
</td>
<td style="width:8%">
<label for="">Set Status</label><br>
<input type="checkbox" name="Status" id="tab_status" value="Active">
<label for="tab_status"> Active</label><br>
<input type="checkbox" name="Status" id="tab_status"
value="Inactive">
<label for="tab_status"> Inactive</label>
</td>
<!-- <td style="width:8%">
<label for="">Is Lab Checkup?</label><br>
<input type="checkbox" name="type_state" id="type_state"
value="Yes">
<label for="type_state"> Yes</label><br>
<input type="checkbox" name="type_state" id="type_state" value="No">
<label for="type_state"> No</label>
</td> -->
<!-- <td style="width:8%">
<label for="">Section Choice Available?</label><br>
<input type="checkbox" name="sec_choice" id="sec_choice"
value="Yes">
<label for="sec_choice"> Yes</label><br>
<input type="checkbox" name="sec_choice" id="sec_choice" value="No">
<label for="sec_choice"> No</label>
</td> -->
<td style="width: 8%;">
<label for="">Applicable Ohcs</label>
<br>
<select class="chosen-select" multiple name="ohc_id[]" id="ohc_id">
<option value="">--select--</option>
<?= generateOption('ohc_type', 'ohc_type_name', 'ohc_type_id', '', ''); ?>
</select>
</td>
<td style="width: 8%;">
<label for="">Applicable Roles</label>
<br>
<select class="chosen-select" multiple name="roles_id[]"
id="roles_id">
<option value="">--select--</option>
<?= generateOption('role_master', 'role_name', 'role_id', '', ''); ?>
</select>
</td>
<td style="width: 8%;">
<label for="">Applicable Checkup Type</label>
<br>
<select class="from-control select2" name="checkup_id"
id="checkup_id">
<option value="">--select--</option>
<?= generateCheckupOptionsAccToOhc('checkup_type', 'checkup_type_name', 'checkup_type_id', '', '', 'type_status', 'Active', $_SESSION['current_ohcttype']); ?>
</select>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<!-- End box-body-->
<!--box-footer-->
<?php
//$hasWriteAccess = isAccessible ( $_SESSION ['RoleId'], $menu_key, 'W' );
?>
<?php //if ($hasWriteAccess) {
?>
<div class="box-footer" style="text-align: center;">
<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>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-info save_button" type="button" id="save_button"
onclick="validate();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
Save
</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-info clone_button" type="button" style="display:none;"
id="clone_button" onclick="validate_clone();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
Clone
</button>
</div>
<?php //}
?>
<!--End box-footer-->
</form>
</div>
<!-- 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>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<!-- End of breadcrumb -->
<div class="page-content" style="margin-top: -47px;">
<div id="flexigridDiv" class="table-responsive">
<form><input type="hidden" name="f1" method="post" id="flex_appointment_form"
action="bio_medical_waste_generation_excel.php">
<div id="flex1" style="width:100%">
<input type="hidden" name="flex_tab_id" id="flex_tab_id" />
</div>
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action"
value="checkup_type_pdf.php" />
<input type="hidden" name="excel_action" id="excel_action"
value="checkup_type_excel.php" />
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$('input[type="checkbox"] ').on('change', function () {
$(this).siblings('input[type="checkbox"]').prop('checked', false);
});
$(function () {
var w = screen.width * .95;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .50;
$("#flex1").flexigrid({
url: 'checkup_tab_master_script.php',
dataType: 'json',
colModel: [
{
display: 'Sr No.',
name: 'tab_id',
width: w * .10,
sortable: true,
align: 'center'
},
{
display: '',
name: 'link',
width: w * .10,
sortable: false,
align: 'center'
},
{
display: 'Checkup Tab Name',
name: 'tab_name',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Checkup Tab Code',
name: 'tab_code',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Checkup Type Name',
name: 'checkup_type_id',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Checkup Sections',
name: 'GROUP_CONCAT(d.section_name)',
width: w * .35,
sortable: true,
align: 'left'
},
{
display: 'Applicable Ohcs',
name: 'ohc_ids',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Applicable Roles',
name: 'tab_access_roles',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Status',
name: 'tab_status',
width: w * .1,
sortable: true,
align: 'left'
},
// {
// display: 'Valid Duration',
// name: 'valid_upto',
// width: w * .1,
// sortable: true,
// align: 'left'
// },
{
display: 'Tab Order',
name: 'tab_order',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Tab Icon',
name: 'tab_icon',
width: w * .10,
sortable: true,
align: 'left'
}
// {
// display: 'Lab Checkup',
// name: 'type_state',
// width: w * .1,
// sortable: true,
// align: 'left'
// },
// {
// display: 'Section Selectable',
// name: 'sec_choice',
// width: w * .1,
// sortable: true,
// align: 'left'
// },
// {
// display: 'Cost',
// name: 'cost',
// width: w * .1,
// sortable: true,
// align: 'left'
// }
],
buttons: [
// {name: 'Add', bclass: 'add', onpress : add},
//{separator: true},
//{name: 'PDFReport', bclass: 'print', onpress : pdfReport},
// {separator: true},
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
}
],
searchitems: [
//{display: 'Patient Name', name : 'patient_name' },
{
display: 'Checkup Tab Name',
name: 'tab_name'
},
{
display: 'Checkup Tab Code',
name: 'tab_code'
},
],
sortname: "tab_id",
sortorder: "asc",
usepager: true, //pagination
//title:"Employee OPD",
useRp: true,
rp: 20, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
// width: w,
height: h,
singleSelect: true
});
});
// function add() {
// $("#tab_name").val("");
// $("#tab_code").val("");
// //$('#modal-add-ambulance-form').modal("show");
// }
function show_save_button() {
$("#save_button").show();
$("#tab_id").val("");
// $("#checkup_form_section_ids[]").reload();
//location.reload();
$(".chosen-select").val("").trigger('chosen:updated');
}
function save_checkup_tab_details() {
$.ajax({
url: 'save_checkup_tab.php',
type: "POST",
data: $("#checkup_tab_movement_form").serialize(),
success: function (data) {
BootstrapDialog.alert('Checkup Tab Details Saved Successfully.');
$("#flex1").flexReload();
$("#tab_id").val("");
$("#tab_name").val("");
$("#tab_code").val("");
$("#checkup_form_section_ids[]").val("");
$("#ohc_id[]").val("");
$("#roles_id[]").val("");
return;
},
error: function (data) {
BootstrapDialog.alert('Error Saving Checkup Tab Details');
return;
}
});
$('.close').click();
}
function save_clone_checkup_type_details() {
$.ajax({
url: 'save_clone_checkup_type.php',
type: "POST",
data: $("#checkup_tab_movement_form").serialize(),
success: function (data) {
BootstrapDialog.alert('Checkup type Details Clone Successfully.');
$("#flex1").flexReload();
$("#tab_id").val("");
$("#tab_name").val("");
$("#tab_code").val("");
$("#checkup_form_section_ids[]").val("");
return;
},
error: function (data) {
BootstrapDialog.alert('Error Saving Checkup type Details');
return;
}
});
$('.close').click();
}
// function open_checkup_type_move(flex_tab_id, action) {
// if (action == "V") {
// //$(".save_button").hide()
// location.href = "view_checkup_type.php?flex_tab_id=" + flex_tab_id + "";
// $(".save_button").hide()
// } else {
// location.href = "checkup_type_master.php?flex_tab_id=" + flex_tab_id + "";
// }
// }
function delete_checkup_tab_form(tab_id) {
$.ajax({
url: 'delete_checkup_tab.php',
data: {
'tab_id': tab_id
},
type: 'POST',
dataType: 'json',
success: function (data) {
if (data == 'SUCCESS') {
BootstrapDialog.alert('Deleled Checkup Tab Details Successfully');
$("#flex1").flexReload();
return;
}
},
error: function (data) {
BootstrapDialog.alert('Error in deleting checkup tab Details');
return;
}
});
}
function open_checkup_tab_form(tab_id, access, task) {
if (access == 'V') {
$("#save_button").hide()
} else if (access == 'E') {
if (task == 'clone') {
$("#save_button").hide();
$("#clone_button").show();
} else {
$("#save_button").show();
$("#clone_button").hide();
}
$.ajax({
url: 'select_checkup_tab_master.php',
data: {
'tab_id': tab_id
},
type: 'POST',
dataType: 'json',
success: function (data) {
$("#tab_id0").val(data.tab_id);
$("#tab_name0").val(data.tab_name);
$("#tab_code0").val(data.tab_code);
$("#tab_order0").val(data.tab_order);
$("#tab_icon0").val(data.tab_icon);
$("#checkup_id").val(data.checkup_type_id);
$("#checkup_id").select2();
// $("#valid_duration0").val(data.valid_upto);
// $("#cost0").val(data.cost);
if (data.checkup_section_assigned != null) {
var checkup_form_section_id = data.checkup_section_assigned
dataarray = checkup_form_section_id.split(",");
$("#checkup_form_section_ids").val(dataarray);
$("#checkup_form_section_ids").trigger('chosen:updated');
}
if (data.ohc_ids != null) {
var ohc_id = data.ohc_ids
dataarray = ohc_id.split(",");
$("#ohc_id").val(dataarray);
$("#ohc_id").trigger('chosen:updated');
}
if (data.tab_access_roles != null) {
var tab_access_roles = data.tab_access_roles
dataarray = tab_access_roles.split(",");
$("#roles_id").val(dataarray);
$("#roles_id").trigger('chosen:updated');
}
$('input:checkbox[id=tab_status][value=' + data.tab_status + ']').prop(
'checked', true);
// $('input:checkbox[id=type_state][value=' + data.type_state + ']').prop(
// 'checked', true);
// $('input:checkbox[id=sec_choice][value=' + data.sec_choice + ']').prop(
// 'checked', true);
//$('#modal-add-ambulance-form').modal("show");
},
error: function (data) {
BootstrapDialog.alert('Error Populating Checkup Section Details');
return;
}
});
}
}
function pdf() {
window.open('checkup_type_pdf.php');
}
function excel() {
window.open('checkup_type_excel.php');
}
// function myDateFormat(date){
// var d=new Date(date);
// var day=d.getDate();
// var m=d.getMonth()+1;
// var y=d.getFullYear();
// return day+"-"+m+"-"+y;
// }
</script>
<?php // include('techsyn_footer.php');
?>
</div>
<!-- End of page-content -->
</div>
</div>
</div>
<script>
function validate() {
var tab_name0 = $('#tab_name0').val();
if (tab_name0 == '') {
BootstrapDialog.alert('Please Enter Checkup Tab Name.!!!');
return false;
}
var tab_code = $('#tab_code0').val();
if (tab_code == '') {
BootstrapDialog.alert('Please Enter Checkup Tab code.!!!');
return false;
}
for (let i = 0; i < tab_code.length; i++) {
let result = isValid(tab_code[i]);
if (!result) {
BootstrapDialog.alert("You can not enter spaces and special characters in checkup tab code");
return result;
}
}
save_checkup_tab_details();
}
function validate_clone() {
var tab_name0 = $('#tab_name0').val();
if (tab_name0 == '') {
BootstrapDialog.alert('Please Enter CHECKUP TAB NAME.!!!');
return false;
}
var tab_code = $('#tab_code0').val();
if (tab_code == '') {
BootstrapDialog.alert('Please Enter Checkup code.!!!');
return false;
}
for (let i = 0; i < tab_code.length; i++) {
let result = isValid(tab_code[i]);
if (!result) {
BootstrapDialog.alert("You can not enter spaces and special characters in CHECKUP TAB CODE");
return result;
}
}
save_clone_checkup_type_details();
}
$("#tab_code0").keypress(function (event) {
var character = String.fromCharCode(event.keyCode);
// alert(character);
// alert(isValid(character));
return isValid(character);
});
function isValid(str) {
return !/[~`!@#$%\^&*()+=\-\\ \[\]\\';,/{}|\\":<>\?]/g.test(str);
}
</script>
<script src="assets/js/select2.min.js"></script>
<style>
#modal-add-ailment {
overflow-y: scroll;
}
</style>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-38894584-2', 'auto');
ga('send', 'pageview');
$('.select2').select2()
$(document).one('ajaxloadstart.page', function (e) {
//in ajax mode, remove remaining elements before leaving page
try {
$('.editable').editable('destroy');
} catch (e) { }
$('[class*=select2]').remove();
});
</script>
<?php include ('techsyn_footer.php'); ?>
<!--
<?php //include('techsyn_footer.php');
?> -->
<!-- <script type="text/javascript">
$('.select2').select2()
jQuery(function($) {
var myTable =
$('#dynamic-table')
.DataTable( {
bAutoWidth: false,
"aoColumns": [
{ "bSortable": false },
null, null,null, null, null,
{ "bSortable": false }
],
"aaSorting": [],
select: {
style: 'multi'
}
} );
var defaultCopyAction = myTable.button(1).action();
myTable.button(1).action(function (e, dt, button, config) {
defaultCopyAction(e, dt, button, config);
$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
});
var defaultColvisAction = myTable.button(0).action();
myTable.button(0).action(function (e, dt, button, config) {
defaultColvisAction(e, dt, button, config);
if($('.dt-button-collection > .dropdown-menu').length == 0) {
$('.dt-button-collection')
.wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
.find('a').attr('href', '#').wrap("<li />")
}
$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
});
setTimeout(function() {
$($('.tableTools-container')).find('a.dt-button').each(function() {
var div = $(this).find(' > div').first();
if(div.length == 1) div.tooltip({container: 'body', title: div.parent().text()});
else $(this).tooltip({container: 'body', title: $(this).text()});
});
}, 500);
myTable.on( 'select', function ( e, dt, type, index ) {
if ( type === 'row' ) {
$( myTable.row( index ).node() ).find('input:checkbox').prop('checked', true);
}
} );
myTable.on( 'deselect', function ( e, dt, type, index ) {
if ( type === 'row' ) {
$( myTable.row( index ).node() ).find('input:checkbox').prop('checked', false);
}
} );
$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;
$('#dynamic-table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) myTable.row(row).select();
else myTable.row(row).deselect();
});
});
$('#dynamic-table').on('click', 'td input[type=checkbox]' , function(){
var row = $(this).closest('tr').get(0);
if(this.checked) myTable.row(row).deselect();
else myTable.row(row).select();
});
$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault();
});
var active_class = 'active';
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;
$(this).closest('table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
});
});
$('#simple-table').on('click', 'td input[type=checkbox]' , function(){
var $row = $(this).closest('tr');
if($row.is('.detail-row ')) return;
if(this.checked) $row.addClass(active_class);
else $row.removeClass(active_class);
});
$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
function tooltip_placement(context, source) {
var $source = $(source);
var $parent = $source.closest('table')
var off1 = $parent.offset();
var w1 = $parent.width();
var off2 = $source.offset();
if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
return 'left';
}
/***************/
$('.show-details-btn').on('click', function(e) {
e.preventDefault();
$(this).closest('tr').next().toggleClass('open');
$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass('fa-angle-double-up');
});
/***************/
})
$('.date-picker').datepicker({
autoclose:true,
format:'dd/mm/yyyy'
}).next().on(ace.click_event,function(){
$(this).prev().focus();
});
</script>-->
<!--
<script type="text/javascript"> -->
<!-- <script type="text/javascript">
$(document).ready(function () {
var counter = $("#count_items").val();
//alert (counter);
$("#addrow").on("click", function () {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="text" class="form-control" id="section_name' + counter + '" name="section_name' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="section_desc' + counter + '" name="section_desc' + counter + '"/></td>';
cols += '<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
newRow.append(cols);
$("#myTable").append(newRow);
/*$('#item_id'+counter).chosen({allow_single_deselect:true});
$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});*/
counter++;
// $('.select2').select2()
// $("#count_items").val(counter);
// $('.date-picker').datepicker({
// autoclose: true,
// todayHighlight: true
// })
});
$("#myTable").on("click", "#deletebtn", function (event) {
$(this).closest("tr").remove();
counter -= 1
$("#count_items").val(counter);
});
});
</script> -->