816 lines
25 KiB
PHP
816 lines
25 KiB
PHP
<?php include('techsyn_header.php'); ?>
|
|
<!-- Main Content Container for side b 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="active">Patient Visit</li>
|
|
<li class="active">Employees</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
<div class="page-content">
|
|
<div id="flexigridDiv" class="table-responsive">
|
|
|
|
<form name="f1" method="post" id="flex_form_opd" action="">
|
|
<div id="flex1" style="width: 100%"></div>
|
|
<input type="hidden" name="flex_opd_id" id="flex_opd_id" />
|
|
</form>
|
|
<form name="export_form" method="post" id="export_form" action="">
|
|
<input type="hidden" name="flex_employee_appointment_id" id="flex_employee_appointment_id" />
|
|
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_emp_list.php" />
|
|
<input type="hidden" name="excel_action" id="excel_action" value="excel_emp_list.php" />
|
|
</form>
|
|
|
|
<form name="flex_approved_patient_form" method="post" action="" id="flex_approved_patient_form">
|
|
<input type="hidden" name="emp_id" id="emp_id">
|
|
<input type="hidden" name="accessOption" id="accessOption">
|
|
<div id="flex1" style="width: 100%">
|
|
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.page-content -->
|
|
</div>
|
|
</div>
|
|
<!-- /.main-content -->
|
|
|
|
|
|
<script type="text/javascript">
|
|
//alert("screen.height:"+screen.height+",navbar.heigh:"+$("#navbar").height()+",breadcrumbs.height:"+$(".breadcrumbs").height());
|
|
$(function() {
|
|
|
|
var w = $("#flex1").width() * .90;
|
|
|
|
var h = 0;
|
|
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
|
|
//alert(w);
|
|
|
|
$("#flex1").flexigrid({
|
|
url: 'emp_list_script.php',
|
|
dataType: 'json',
|
|
colModel: [{
|
|
display: '',
|
|
name: 'link',
|
|
width: w * .1,
|
|
sortable: false,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Sr',
|
|
name: 'count',
|
|
width: w * .05,
|
|
sortable: false,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'ECode',
|
|
name: 'emp_code',
|
|
width: w * .08,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'National Identity',
|
|
name: 'aadhar_no',
|
|
width: w * .10,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Patient Name',
|
|
name: 'patient_name',
|
|
width: w * .25,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
// {
|
|
// display: 'Patient Surname',
|
|
// name: 'patient_surname',
|
|
// width: w * .25,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
|
|
{
|
|
display: 'Surname',
|
|
name: 'father_surname',
|
|
width: w * .15,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Father name',
|
|
name: 'father_name',
|
|
width: w * .15,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
// {
|
|
// display: 'Patient Type',
|
|
// name: 'patient_cat_name',
|
|
// width: w * .10,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
// {
|
|
// display: 'Contractor/Company',
|
|
// name: 'employer_contractor_name',
|
|
// width: w * .13,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
{
|
|
display: 'Designation',
|
|
name: 'designation_name',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
// {
|
|
// display: 'Division',
|
|
// name: 'bu_name',
|
|
// width: w * .1,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
{
|
|
display: 'Department',
|
|
name: 'dept_name',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
// {
|
|
// display: 'Section',
|
|
// name: 'section_name',
|
|
// width: w * .1,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
// {
|
|
// display: 'Section',
|
|
// name: 'section',
|
|
// width: w * .2,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
{
|
|
display: 'Gender',
|
|
name: 'gender',
|
|
width: w * .08,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Blood Group',
|
|
name: 'blood_group',
|
|
width: w * .08,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Email',
|
|
name: 'offiial_email_id',
|
|
width: w * .10,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Phone',
|
|
name: 'primary_phone',
|
|
width: w * .08,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
|
|
// {
|
|
// display: 'Primary Patient',
|
|
// name: 'primary_patient_id',
|
|
// width: w * .08,
|
|
// sortable: true,
|
|
// align: 'left'
|
|
// },
|
|
{
|
|
display: 'Is OHC STAFF',
|
|
name: 'is_ohc_staff',
|
|
width: w * .08,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Is First Aider',
|
|
name: 'is_first_aid',
|
|
width: w * .08,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
|
|
],
|
|
buttons: [
|
|
|
|
<?php
|
|
if (isAccessible($_SESSION['RoleId'], $menu_key, 'W')) {
|
|
?> {
|
|
name: 'Add',
|
|
bclass: 'add',
|
|
onpress: add
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
/*{name: 'Add', bclass: 'add', onpress : addNew},
|
|
{separator: true},*/
|
|
<?php } ?> {
|
|
name: 'PDF',
|
|
bclass: 'print',
|
|
onpress: pdf
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
{
|
|
name: 'Excel',
|
|
bclass: 'print_excel',
|
|
onpress: excel
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
{
|
|
name: 'Download Template',
|
|
bclass: 'print_excel',
|
|
onpress: download_template
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
{
|
|
name: 'Upload Excel',
|
|
bclass: 'print_excel',
|
|
onpress: upload_excel
|
|
},
|
|
{
|
|
separator: true
|
|
}
|
|
|
|
],
|
|
searchitems: [{
|
|
display: 'Employee Code',
|
|
name: 'emp_code',
|
|
isdefault: true
|
|
},
|
|
{
|
|
display: 'Patient Name',
|
|
name: 'patient_name'
|
|
},
|
|
// {
|
|
// display: 'Patient Type(Employee/Non-Employee)',
|
|
// name: 'patient_cat_name'
|
|
// },
|
|
{
|
|
display: 'Designation',
|
|
name: 'designation_name'
|
|
},
|
|
{
|
|
display: 'Father Name',
|
|
name: 'father_name'
|
|
},
|
|
{
|
|
display: 'Gender(M/F/O)',
|
|
name: 'gender'
|
|
},
|
|
{
|
|
display: 'Blood Group',
|
|
name: 'blood_group'
|
|
},
|
|
{
|
|
display: 'Email',
|
|
name: 'offiial_email_id'
|
|
},
|
|
|
|
{
|
|
display: 'National Identity',
|
|
name: 'aadhar_no'
|
|
},
|
|
// {
|
|
// display: 'Department',
|
|
// name: 'dept_name'
|
|
// },
|
|
// {
|
|
// display: 'contractor Name',
|
|
// name: 'employer_contractor_name'
|
|
// },
|
|
{
|
|
display: 'Is OHC STAFF(Yes/No)',
|
|
name: 'is_ohc_staff'
|
|
},
|
|
{
|
|
display: 'Is First Aider(Yes/No)',
|
|
name: 'is_first_aid'
|
|
},
|
|
|
|
|
|
],
|
|
sortname: "id",
|
|
sortorder: "desc",
|
|
usepager: true, //pagination
|
|
//title:"Employee OPD",
|
|
useRp: true,
|
|
rp: 50, //records per page
|
|
showTableToggleBtn: false, //toggle button for the whole table
|
|
resizable: true,
|
|
// width: w,
|
|
height: h,
|
|
singleSelect: true
|
|
});
|
|
});
|
|
|
|
function pdf() {
|
|
window.open('ajax_pdf.php?appointment_id', 'Employee List');
|
|
}
|
|
|
|
function download_template() {
|
|
window.location = 'templates/Employee List Upload Template.xlx';
|
|
}
|
|
|
|
function upload_excel() {
|
|
window.location = 'upload_excel_emp.php';
|
|
}
|
|
/*
|
|
function excel(){
|
|
window.location = 'excel_emp_list.php';
|
|
} */
|
|
|
|
// function pdf(){
|
|
// window.open('ajax_pdf.php','Emp List');
|
|
// }
|
|
function excel() {
|
|
window.open('ajax_excel.php', 'Emp List');
|
|
}
|
|
|
|
function add() {
|
|
|
|
window.location = 'add_employee_details.php';
|
|
|
|
}
|
|
/*function add(){
|
|
|
|
|
|
$(".save_button").show();
|
|
$("#employee_id").val("");
|
|
|
|
$("#father_name").val("");
|
|
$('#dob').val("");
|
|
$('#doj').val("");
|
|
//$('#designation_id').val("");
|
|
$('#emp_code').val("");
|
|
//$('#emp_type_id').val("");
|
|
$('#bu_id').val("");
|
|
$('#sbu_id').val("");
|
|
$('#section_id').val("");
|
|
$('#sub_section_id').val("");
|
|
$('#mgr_emp_id').val("");
|
|
//$('#gender').val("");
|
|
$('#address').val("");
|
|
$('#primary_phone').val("");
|
|
$('#email').val("");
|
|
$('#aadhar_no').val("");
|
|
$('#ohc_type_id').val("");
|
|
$('#status').val("");
|
|
//$('#blood_group').val("");
|
|
$('#photo').val("");
|
|
$('#profile_photo').attr("src","images/male-profile.png");
|
|
$('#modal-add-patient_master').modal("show");
|
|
|
|
}*/
|
|
|
|
function save_employee() {
|
|
// var file_data = $('#photo').prop('files')[0];
|
|
//var form_data = ;
|
|
//form_data.append('photo', file_data);
|
|
|
|
$.ajax({
|
|
url: 'save_employee.php',
|
|
type: "POST",
|
|
data: $("#employee_form").serialize(),
|
|
success: function(data) {
|
|
BootstrapDialog.alert('Employee Saved Successfully.');
|
|
$("#flex1").flexReload();
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Saving Employee');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
|
|
function delete_employee(employeeId) {
|
|
$("#flex_opd_id").val(employeeId);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete the Employee?', function(result) {
|
|
if (result) {
|
|
$.ajax({
|
|
url: 'delete_employee.php',
|
|
type: "POST",
|
|
data: $("#flex_form_opd").serialize(),
|
|
success: function(data) {
|
|
if (data.indexOf("SUCCESS") != -1) {
|
|
BootstrapDialog.alert('Employee Deleted Successfully.');
|
|
$("#flex1").flexReload();
|
|
|
|
} else {
|
|
BootstrapDialog.alert('Error Deleting Employee');
|
|
}
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Deleting User');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
var employee_id = "";
|
|
|
|
function open_employee(employeeId, action) {
|
|
var id = "";
|
|
if (action == "V") {
|
|
$(".save_button").hide();
|
|
$("#flex_approved_medical_form").attr('action', 'add_patient_details_ime_long_term.php');
|
|
|
|
} else {
|
|
$(".save_button").show();
|
|
}
|
|
$.ajax({
|
|
url: 'select_employee.php?employeeId=' + employeeId + ' ',
|
|
type: 'POST',
|
|
|
|
success: function(data) {
|
|
//alert(data);
|
|
data = $.parseJSON(data);
|
|
//alert(data);
|
|
|
|
$("#employee_id").val(data.id);
|
|
$("#patient_name").val(data.patient_name);
|
|
$("#father_name").val(data.father_name);
|
|
$("#dob").val(myDateFormater(data.dob));
|
|
$("#doj").val(myDateFormater(data.doj));
|
|
$("#designation_id").val(data.designation_id);
|
|
$("#emp_code").val(data.emp_code);
|
|
$("#emp_type_id").val(data.employment_type_id);
|
|
$("#bu_id").val(data.bu_id);
|
|
$("#sbu_id").val(data.sbu_id);
|
|
$("#section_id").val(data.section_id);
|
|
$("#sub_section_id").val(data.sub_section_id);
|
|
$("#mgr_emp_id").val(data.mgr_emp_id);
|
|
$("#gender").val(data.gender);
|
|
$("#address").val(data.address);
|
|
$("#primary_phone").val(data.primary_phone);
|
|
$("#passport").val(data.passport);
|
|
$("#email").val(data.email_id);
|
|
$("#aadhar_no").val(data.aadhar_no);
|
|
$("#ohc_type_id").val(data.ohc_type_id);
|
|
$("#status").val(data.status);
|
|
$("#blood_group").val(data.blood_group);
|
|
$("#has_first_aid").val(data.is_first_aid);
|
|
//alert(data.photo);
|
|
if (data.photo == null || data.photo == "") {
|
|
$("#profile_photo").attr("src", "images/male-profile.png");
|
|
} else {
|
|
$("#profile_photo").attr("src", "data:" + data.image_type + ";base64," + data.photo);
|
|
}
|
|
$('#modal-add-patient_master').modal("show");
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Populating User');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
function open_employee_details(emp_id, action) {
|
|
|
|
if (emp_id != null && emp_id != '' && action != null && action != '') {
|
|
$("#emp_id").val(emp_id);
|
|
$("#accessOption").val(action);
|
|
|
|
$("#flex_approved_patient_form").attr('method', 'POST');
|
|
|
|
if (action == 'V') {
|
|
$("#flex_approved_patient_form").attr('action', 'view_employee_details.php');
|
|
} else if (action == 'E') {
|
|
$("#flex_approved_patient_form").attr('action', 'edit_employee_details.php');
|
|
}
|
|
|
|
$("#flex_approved_patient_form").submit();
|
|
}
|
|
|
|
}
|
|
|
|
function open_dashboard(emp_id) {
|
|
if (emp_id != null && emp_id != '') {
|
|
$("#flex_opd_id").val(emp_id);
|
|
|
|
$("#flex_form_opd").attr('method', 'POST');
|
|
$("#flex_form_opd").attr('action', 'emp_dashboard.php');
|
|
$("#flex_form_opd").submit();
|
|
|
|
}
|
|
}
|
|
</script>
|
|
<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>
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<?php include('form/add_employee.php'); ?>
|
|
<script>
|
|
function myDateFormater(myDate) {
|
|
var d = new Date(myDate);
|
|
var m = d.getMonth() + 1;
|
|
var y = d.getFullYear();
|
|
var date = d.getDate();
|
|
// alert(date+"/"+m+"/"+y);
|
|
return date + "/" + m + "/" + y;
|
|
|
|
|
|
}
|
|
|
|
jQuery(function($) {
|
|
//initiate dataTables plugin
|
|
var myTable =
|
|
$('#dynamic-table')
|
|
//.wrap("<div class='dataTables_borderWrap' />") //if you are applying horizontal scrolling (sScrollX)
|
|
.DataTable({
|
|
bAutoWidth: false,
|
|
"aoColumns": [{
|
|
"bSortable": false
|
|
},
|
|
null, null, null, null, null,
|
|
{
|
|
"bSortable": false
|
|
}
|
|
],
|
|
"aaSorting": [],
|
|
|
|
|
|
//"bProcessing": true,
|
|
//"bServerSide": true,
|
|
//"sAjaxSource": "http://127.0.0.1/table.php" ,
|
|
|
|
//,
|
|
//"sScrollY": "200px",
|
|
//"bPaginate": false,
|
|
|
|
//"sScrollX": "100%",
|
|
//"sScrollXInner": "120%",
|
|
//"bScrollCollapse": true,
|
|
//Note: if you are applying horizontal scrolling (sScrollX) on a ".table-bordered"
|
|
//you may want to wrap the table inside a "div.dataTables_borderWrap" element
|
|
|
|
//"iDisplayLength": 50
|
|
|
|
|
|
select: {
|
|
style: 'multi'
|
|
}
|
|
});
|
|
|
|
|
|
|
|
//style the message box
|
|
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);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////
|
|
//table checkboxes
|
|
$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
|
|
|
|
//select/deselect all rows according to table header checkbox
|
|
$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(
|
|
0).on('click', function() {
|
|
var th_checked = this.checked; //checkbox inside "TH" table header
|
|
|
|
$('#dynamic-table').find('tbody > tr').each(function() {
|
|
var row = this;
|
|
if (th_checked) myTable.row(row).select();
|
|
else myTable.row(row).deselect();
|
|
});
|
|
});
|
|
|
|
//select/deselect a row when the checkbox is checked/unchecked
|
|
$('#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();
|
|
});
|
|
|
|
|
|
|
|
//And for the first simple table, which doesn't have TableTools or dataTables
|
|
//select/deselect all rows according to table header checkbox
|
|
var active_class = 'active';
|
|
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
|
|
var th_checked = this.checked; //checkbox inside "TH" table header
|
|
|
|
$(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);
|
|
});
|
|
});
|
|
|
|
//select/deselect a row when the checkbox is checked/unchecked
|
|
$('#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);
|
|
});
|
|
|
|
|
|
|
|
/********************************/
|
|
//add tooltip for small view action buttons in dropdown menu
|
|
$('[data-rel="tooltip"]').tooltip({
|
|
placement: tooltip_placement
|
|
});
|
|
|
|
//tooltip placement on right or left
|
|
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();
|
|
//var w2 = $source.width();
|
|
|
|
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');
|
|
});
|
|
/***************/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
//add horizontal scrollbars to a simple table
|
|
$('#simple-table').css({'width':'2000px', 'max-width': 'none'}).wrap('<div style="width: 1000px;" />').parent().ace_scroll(
|
|
{
|
|
horizontal: true,
|
|
styleClass: 'scroll-top scroll-dark scroll-visible',//show the scrollbars on top(default is bottom)
|
|
size: 2000,
|
|
mouseWheelLock: true
|
|
}
|
|
).css('padding-top', '12px');
|
|
*/
|
|
|
|
|
|
})
|
|
|
|
|
|
$('#doj').datepicker({
|
|
autoclose: true,
|
|
format: 'dd/mm/yyyy',
|
|
startDate: '1d/1m/2000y',
|
|
endDate: 'current',
|
|
todayHighlight: true
|
|
}).next().on(ace.click_event, function() {
|
|
$(this).prev().focus();
|
|
});
|
|
$('#dob').datepicker({
|
|
autoclose: true,
|
|
format: 'dd/mm/yyyy',
|
|
startDate: '1d/1m/1970y',
|
|
|
|
}).next().on(ace.click_event, function() {
|
|
$(this).prev().focus();
|
|
|
|
});
|
|
</script>
|