ESH/shift_pdf.php
2024-10-23 18:28:06 +05:30

911 lines
31 KiB
PHP

<script src="https://code.jquery.com/jquery-3.7.0.js" integrity="sha256-JlqSTELeR4TLqP0OG9dxM7yDPqX1ox/HfgiSLBj8+kM=" crossorigin="anonymous"></script>
<center>
<!-- <input type="button" class="btn btn-primary" value="PRINT" onclick="printDiv()"> -->
<button id="printPageButton" class="btn btn-success print" onClick="window.print();">Print</button>
</center>
<br>
<?php
include('log_entry.php');
include ('constants.php');
include ('includes/config/config.php');
include_once ("includes/functions.php");
include_once("includes/cached_functions.php");
?>
<?php
error_reporting(E_ALL & ~ E_WARNING & ~ E_NOTICE);
$ohc_type = $_SESSION['current_ohcttype']?>
<!--breadcrumb-->
<?php
$db_new_date="";
$last_day="";
$m=0;
$y=0;
$selectedShiftMonth = $_POST['shift_m'];
//echo "month......".$selectedShiftMonth;
$selectedShiftYear = $_POST['shift_y'];
//echo "year.........".$selectedShiftYear;
if(isset($selectedShiftYear)&& $selectedShiftYear!="" && isset($selectedShiftMonth) && $selectedShiftMonth!=""){
$last_day = date("t-m-Y", strtotime("".$selectedShiftYear."-".($selectedShiftMonth+1)."-01"));
// echo "last:date".$last_day;
}
else{
$last_day = date('t-m-Y');
//echo "last:date1".$last_day;
}
$m = date('m',strtotime("".$selectedShiftYear."-".($selectedShiftMonth+1)."-01"));
////echo "month det".$m;
$y = date('Y',strtotime("".$selectedShiftYear."-".($selectedShiftMonth+1)."-01"));
//echo "year det".$y;
$shift_status_options =generateOptionForMultiple('shift_status','status_name','shift_status_id','','');
?>
<script>
var jsonArrayShiftData = <?php echo json_encode($shift_data); ?>;
</script>
<style>
@media print {
#printPageButton {
display: none;
}
}
/* ul{
background-color: #D6DBDF;
}
.tdm{
background-color: #D6DBDF;
}
select:disabled {
color: black;
} */
</style>
<div id="DivIdToPrint" class="DivIdToPrint">
<form id="shift_form" method="post">
<!-- box-body-->
<div class="box-body" id="reload_amb">
<div class="row" >
<div id="shift_table">
<table style="" border="1" id="myTable"
class="">
<thead>
<tr>
<td></td>
<td>Date</td>
<?php
for($j=1; $j<=$last_day; $j++){
$new_date = $j."-".$m."-".$y;
$day = date('D', strtotime($new_date));
?>
<td><?php echo $j?></td>
<?php }?>
</tr>
<tr>
<td>S No.</td>
<td>Day / Staff Name</td>
<?php
// $last_day = date('t-m-Y');
// $m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$day = date('D', strtotime($new_date));
?>
<td><?php echo $day?></td>
<?php }?>
</tr>
</thead>
<tbody>
<?php $count = 1;
$query = "Select id,patient_name from patient_master where is_ohc_staff='1' and ohc_type_id='".$_SESSION['current_ohcttype']."' ";
$result = @mysqli_query($conn,$query);
while( $row = mysqli_fetch_assoc($result)){
?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo $row['patient_name']; ?></td>
<input type="hidden" name="emp_id<?php echo $count?>" id="emp_id<?php echo $count?>" value="<?php echo $row['id'];?>" />
<?php $shift_id="";
$shift_data =array();
$query1 = "Select shift_id,shift_date, emp_id, shift_status from shift_details where ohc_type_id='".$_SESSION['current_ohcttype']."' and month(shift_date)='". $m."' and year(shift_date)='".$y."' ";
error_log($query1."dipak mali" );
//echo "selet query......................................".$query1 ;
$result1 = @mysqli_query($conn,$query1);
while( $row_shift = @mysqli_fetch_assoc($result1)){
//echo "adarsh";
$shift_id=$row_shift['shift_id'];
$key=$row_shift['emp_id'].'_'.$row_shift['shift_date'];
//echo "key:".$key;
$value=$row_shift['shift_status'];
//echo "value:".$value;
$shift_data[$key]=$value;
// array_push($shift_data[$key], $value);
?>
<input type="hidden" name="shift_id<?php echo $count?>" id="shift_id<?php echo $count?>" value="<?php echo $shift_id?>" />
<?php }?>
<?php
$db_new_date="";
// $last_day = date('t-m-Y');
//$m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$db_new_date = $y."-".$m."-".$k;
$day = date('D', strtotime($new_date));
if($k<10){
$db_new_date = $y."-".$m."-0".$k;
}
?>
<?php
//echo "key:".$row['id'].'_'.$db_new_date;
?>
<td >
<p id="shift_status_<?php echo $count?>_<?php echo $k?>"></p>
<script>
$( document ).ready(function() {
<?php $key=$row['id'].'_'.$db_new_date;?>
var existingShiftValues<?php echo $count?>_<?php echo $k?> = "<?php echo $shift_data[$key]?>"
// $("#shift_status_<?php echo $count?>_<?php echo $k?>").val(existingShiftValues<?php echo $count?>_<?php echo $k?>.split(',')).trigger("select2");
$.ajax({
url : 'select_shift_data.php ',
type : "POST",
data : {'ids': existingShiftValues<?php echo $count?>_<?php echo $k?>.split(',') },
success : function(data) {
$("#shift_status_<?php echo $count?>_<?php echo $k?>").html(data)
},
error : function(data) {
console.log(data);
}
});
});
</script>
</td>
<input type="hidden" name="shift_date_<?php echo $count?>_<?php echo $k?>" id="shift_date_<?php echo $count?>_<?php echo $k?>" value="<?php echo $new_date?>" />
<?php }?>
</tr>
<?php
$count++;
};
?>
</tbody>
<tfoot>
<tr>
<td></td>
<td>Total Shift</td>
<?php
$db_new_date="";
// $last_day = date('t-m-Y');
//$m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$db_new_date = $y."-".$m."-".$k;
$day = date('D', strtotime($new_date));
if($k<10){
$db_new_date = $y."-".$m."-0".$k;
}
$total_shift="select sum(LENGTH(shift_status) - LENGTH(REPLACE(shift_status, ',', '')) + 1) cnt from shift_details where shift_id in ( (SELECT MAX(shift_id) shift_id FROM shift_details
where ohc_type_id='".$_SESSION['current_ohcttype']."' and shift_date='". $db_new_date."' GROUP BY emp_id))";
// $total_shift="SELECT count(*) as total FROM shift_details a inner join shift_status b on a.shift_status=b.shift_status_id where shift_date='". $db_new_date."' and b.is_shift='Y' ";
// echo "nnnnnnnnnnnnnnnnnnnnn".$total_shift;
$result_total_shift = @mysqli_query($conn,$total_shift);
// echo "ffffffffffffffffff". $result_total_shift;
$shift_total="";
while( $row_result_total_shift = mysqli_fetch_assoc( $result_total_shift)){
$shift_total=$row_result_total_shift['cnt'];
}
?>
<td><?php echo $shift_total ??0 ?></td>
<?php } ?>
</tr>
<tr>
<td></td>
<td>Staff In Shift A</td>
<?php
$db_new_date="";
// $last_day = date('t-m-Y');
//$m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$db_new_date = $y."-".$m."-".$k;
$day = date('D', strtotime($new_date));
if($k<10){
$db_new_date = $y."-".$m."-0".$k;
}
// $shiftDel="delete from tmptable";
// $result_total_shiftA_D = @mysqli_query($conn,$shiftDel);
// //$query_initial="select COUNT(shiftstatus) shift_1 from tmptable where shiftstatus=1 ";
// $shift_A="INSERT INTO tmptable(emp_id,shiftstatus) select s.emp_id,SUBSTRING_INDEX(SUBSTRING_INDEX(s.shift_status, ',', numbers.n), ',', -1) shiftstatus from numbers inner join shift_details s on CHAR_LENGTH(s.shift_status)
// -CHAR_LENGTH(REPLACE(shift_status, ',', ''))>=numbers.n-1 where shift_id in ( (SELECT MAX(shift_id) shift_id FROM shift_details where shift_date='". $db_new_date."' GROUP BY emp_id)) order by emp_id, n";
$result_total_shiftA = @mysqli_query($conn,$shift_A);
$shiftA_1="select COUNT(distinct(emp_id)) shift_1 from shift_details where ohc_type_id='".$_SESSION['current_ohcttype']."' and shift_date='". $db_new_date."' and shift_status like '%8%' ";
$result_total_shiftA1 = @mysqli_query($conn,$shiftA_1);
// echo "nnnnnnnnnnnnnnnnnnnnn".$result_total_shiftA;
$shift_totalA="";
while( $row_result_total_shiftA1 = mysqli_fetch_assoc( $result_total_shiftA1)){
$shift_totalA=$row_result_total_shiftA1['shift_1'];
}
?>
<td><?php echo $shift_totalA ?></td>
<?php } ?>
</tr>
<tr>
<td></td>
<td>Staff In Shift B</td>
<?php
$db_new_date="";
// $last_day = date('t-m-Y');
//$m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$db_new_date = $y."-".$m."-".$k;
$day = date('D', strtotime($new_date));
if($k<10){
$db_new_date = $y."-".$m."-0".$k;
}
// $shiftDel="delete from tmptable";
// $result_total_shiftB_D = @mysqli_query($conn,$shiftDel);
// //$query_initial="select COUNT(shiftstatus) shift_1 from tmptable where shiftstatus=1 ";
// $shift_B="INSERT INTO tmptable(emp_id,shiftstatus) select s.emp_id,SUBSTRING_INDEX(SUBSTRING_INDEX(s.shift_status, ',', numbers.n), ',', -1) shiftstatus from numbers inner join shift_details s on CHAR_LENGTH(s.shift_status)
// -CHAR_LENGTH(REPLACE(shift_status, ',', ''))>=numbers.n-1 where shift_id in ( (SELECT MAX(shift_id) shift_id FROM shift_details where shift_date='". $db_new_date."' GROUP BY emp_id)) order by emp_id, n";
$result_total_shiftB = @mysqli_query($conn,$shift_B);
$shiftB_1="select COUNT(distinct(emp_id)) shift_2 from shift_details where ohc_type_id='".$_SESSION['current_ohcttype']."' and shift_date='". $db_new_date."' and shift_status like '%9%' ";
$result_total_shiftB1 = @mysqli_query($conn,$shiftB_1);
// echo $shiftB_1;
$shift_totalB="";
while( $row_result_total_shiftB1 = mysqli_fetch_assoc( $result_total_shiftB1)){
$shift_totalB=$row_result_total_shiftB1['shift_2'];
}
?>
<td><?php echo $shift_totalB ?></td>
<?php } ?>
</tr>
<tr>
<td></td>
<td>Staff In Shift C</td>
<?php
$db_new_date="";
// $last_day = date('t-m-Y');
//$m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$db_new_date = $y."-".$m."-".$k;
$day = date('D', strtotime($new_date));
if($k<10){
$db_new_date = $y."-".$m."-0".$k;
}
// $shiftDel="delete from tmptable";
// $result_total_shiftg_D = @mysqli_query($conn,$shiftDel);
// //$query_initial="select COUNT(shiftstatus) shift_1 from tmptable where shiftstatus=1 ";
// $shift_c="INSERT INTO tmptable(emp_id,shiftstatus) select s.emp_id,SUBSTRING_INDEX(SUBSTRING_INDEX(s.shift_status, ',', numbers.n), ',', -1) shiftstatus from numbers inner join shift_details s on CHAR_LENGTH(s.shift_status) -CHAR_LENGTH(REPLACE(shift_status, ',', ''))>=numbers.n-1 where shift_id in ( (SELECT MAX(shift_id) shift_id FROM shift_details where shift_date='". $db_new_date."' GROUP BY emp_id)) order by emp_id, n";
$result_total_shiftc = @mysqli_query($conn,$shift_c);
$shiftc_1="select COUNT(distinct(emp_id)) shift_3 from shift_details where ohc_type_id='".$_SESSION['current_ohcttype']."' and shift_date='". $db_new_date."' and shift_status like '%10%' ";
$result_total_shiftc1 = @mysqli_query($conn,$shiftc_1);
// echo "nnnnnnnnnnnnnnnnnnnnn".$result_total_shiftA;
$shift_totalc="";
while( $row_result_total_shiftc1 = mysqli_fetch_assoc( $result_total_shiftc1)){
$shift_totalc=$row_result_total_shiftc1['shift_3'];
}
?>
<td><?php echo $shift_totalc ?></td>
<?php } ?>
</tr>
<tr>
<td></td>
<td>Total No Of Staff</td>
<?php
$db_new_date="";
// $last_day = date('t-m-Y');
//$m = date('m');
// $y = date('Y');
for($k=1; $k<=$last_day; $k++){
$new_date = $k."-".$m."-".$y;
$db_new_date = $y."-".$m."-".$k;
$day = date('D', strtotime($new_date));
if($k<10){
$db_new_date = $y."-".$m."-0".$k;
}
// $shiftDel="delete from tmptable";
// $result_total_shiftS_D = @mysqli_query($conn,$shiftDel);
// //$query_initial="select COUNT(shiftstatus) shift_1 from tmptable where shiftstatus=1 ";
// $shift_s="INSERT INTO tmptable(emp_id,shiftstatus) select s.emp_id,SUBSTRING_INDEX(SUBSTRING_INDEX(s.shift_status, ',', numbers.n), ',', -1) shiftstatus from numbers inner join shift_details s on CHAR_LENGTH(s.shift_status)
// -CHAR_LENGTH(REPLACE(shift_status, ',', ''))>=numbers.n-1 where shift_id in ( (SELECT MAX(shift_id) shift_id FROM shift_details where shift_date='". $db_new_date."' GROUP BY emp_id)) order by emp_id, n";
// $result_total_shifts = @mysqli_query($conn,$shift_s);
$shift_staff=" select count( distinct emp_id) tot_staf from shift_details where ohc_type_id='".$_SESSION['current_ohcttype']."' and shift_date='". $db_new_date."'";
$result_shift_staff = @mysqli_query($conn,$shift_staff);
// echo "nnnnnnnnnnnnnnnnnnnnn".$result_total_shiftA;
$shift_stf="";
while( $row_shift_staff = mysqli_fetch_assoc( $result_shift_staff)){
$shift_stf=$row_shift_staff['tot_staf'];
}
$shiftDel1="delete from tmptable";
$result_total_shiftS_y = @mysqli_query($conn,$shiftDel1);
?>
<td><?php echo $shift_stf ?></td>
<?php } ?>
</tr>
</tfoot>
</table>
<input type="hidden" name="count_items" id="count_items"
value="<?php echo $count-1?>" /> <input type="hidden" name="last_day"
id="last_day" value="<?php echo $last_day?>" />
</div>
</div>
</div>
<!-- End box-body-->
<!--box-footer-->
<!--End box-footer-->
</form>
</div>
<!-- Main Content Container for side bar and body-->
</div>
<!-- End of page-content -->
</div>
</div>
</div>
<form method="POST" id="print_shift_pdf">
<input type="hidden" name="month" id="month" value="<?php echo $m?>">
<input type="hidden" name="year" id="year" value="<?php echo $y?>">
</form>
<script>
function printDiv()
{
window.print();
}
var getDaysInMonth = function(year,month) {
// Here January is 1 based
//Day 0 is the last day in the previous month
return new Date(year, month, 0).getDate();
// Here January is 0 based
// return new Date(year, month+1, 0).getDate();
};
function shiftDetails(){
var shift_month = parseInt($("#shift_month").val());
var shift_year = parseInt($("#shift_year").val());
var content="<tr><td></td><td>Date</td>";
for(var i=1;i<=getDaysInMonth(shift_year,shift_month);i++){
content+='<td>'+i+'</td>'
data_string=i+"/"+shift_month+"/"+shift_year
date = new Date(data_string);
}
var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
content+="<tr><td>S No.</td><td>Days/Staff Name</td>";
for(var i=1;i<=getDaysInMonth(shift_year,shift_month);i++){
//content+='<td>'+i+'</td>'
let data_string=shift_month+"/"+i+"/"+shift_year;
let d=new Date(data_string)
//weekday = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][new Date(data_string).getDay()]
content+='<td>'+days[d.getDay()]+'</td>'
}
$("#myTable").html(content);
}
function validate(){
save();
}
function myCalender(){
var month = $("#shift_month").val();
var year = $("#shift_year").val();
var open_date = '01-'+month+'-'+year;
$("#shift_calendar").val(open_date).show();
}
</script>
<style>
</style>
<?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');
});
/***************/
})
function save(){
$.ajax({
url : 'save_shift_details.php ',
type : "POST",
data : $("#shift_form").serialize(),
success : function(data) {
BootstrapDialog.alert('Shift Details Saved Successfully.');
$("#flex1").flexReload();
document.forms[0].action='';document.forms[0].submit();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving Shift Details');
return;
}
});
$('.close').click();
// location.href="procurement_list.php";
}
$('.date-picker').datepicker({
autoclose:true,
format:'dd/mm/yyyy'
}).next().on(ace.click_event,function(){
$(this).prev().focus();
});
</script>
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="assets/css/chosen.min.css" />
<link rel="stylesheet" href="css/select2.min.css">
<script src="js/select2.full.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
const select = document.getElementById('myselect');
});
</script>
<script type="text/javascript">
jQuery(function($) {
$('#id-disable-check').on('click', function() {
var inp = $('#form-input-readonly').get(0);
if(inp.hasAttribute('disabled')) {
inp.setAttribute('readonly' , 'true');
inp.removeAttribute('disabled');
inp.value="This text field is readonly!";
}
else {
inp.setAttribute('disabled' , 'disabled');
inp.removeAttribute('readonly');
inp.value="This text field is disabled!";
}
});
if(!ace.vars['touch']) {
$('.chosen-select').chosen({allow_single_deselect:true});
$(window)
.off('resize.chosen')
.on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({'width': $this.parent().width()});
})
}).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if(event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({'width': $this.parent().width()});
})
});
$('#chosen-multiple-style .btn').on('click', function(e){
var target = $(this).find('input[type=radio]');
var which = parseInt(target.val());
if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
else $('#form-field-select-4').removeClass('tag-input-style');
});
}
$('[data-rel=tooltip]').tooltip({container:'body'});
$('[data-rel=popover]').popover({container:'body'});
autosize($('textarea[class*=autosize]'));
$('textarea.limited').inputlimiter({
remText: '%n character%s remaining...',
limitText: 'max allowed : %n.'
});
//"jQuery UI Slider"
//range slider tooltip example
$( "#slider-range" ).css('height','200px').slider({
orientation: "vertical",
range: true,
min: 0,
max: 100,
values: [ 17, 67 ],
slide: function( event, ui ) {
var val = ui.values[$(ui.handle).index()-1] + "";
if( !ui.handle.firstChild ) {
$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
.prependTo(ui.handle);
}
$(ui.handle.firstChild).show().children().eq(1).text(val);
}
}).find('span.ui-slider-handle').on('blur', function(){
$(this.firstChild).hide();
});
$( "#slider-range-max" ).slider({
range: "max",
min: 1,
max: 10,
value: 2
});
$( "#slider-eq > span" ).css({width:'80%', 'float':'left', margin:'15px'}).each(function() {
// read initial values from markup and remove that
var value = parseInt( $( this ).text(), 10 );
$( this ).empty().slider({
value: value,
range: "min",
animate: true
});
});
$("#slider-eq > span.ui-slider-purple").slider('disable');//disable third item
$('#id-input-file-1 , #id-input-file-2').ace_file_input({
no_file:'No File ...',
btn_choose:'Choose',
btn_change:'Change',
droppable:false,
onchange:null,
thumbnail:false //| true | large
//whitelist:'gif|png|jpg|jpeg'
//blacklist:'exe|php'
//onchange:''
//
});
//pre-show a file name, for example a previously selected file
//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
//datepicker plugin
//link
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
})
//show datepicker when clicking on the icon
.next().on(ace.click_event, function(){
$(this).prev().focus();
});
//chosen plugin inside a modal will have a zero width because the select element is originally hidden
//and its width cannot be determined.
//so we set the width after modal is show
$('#modal-form').on('shown.bs.modal', function () {
if(!ace.vars['touch']) {
$(this).find('.chosen-container').each(function(){
$(this).find('a:first-child').css('width' , '0');
$(this).find('.chosen-drop').css('width' , '0');
$(this).find('.chosen-search input').css('width' , '0');
});
}
})
/**
//or you can activate the chosen plugin after modal is shown
//this way select element becomes visible with dimensions and chosen works as expected
$('#modal-form').on('shown', function () {
$(this).find('.modal-chosen').chosen();
})
*/
$(document).one('ajaxloadstart.page', function(e) {
autosize.destroy('textarea[class*=autosize]')
$('.limiterBox,.autosizejs').remove();
$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu').remove();
});
});
/*
$(document ).ready(function() {
$('#shift_year').val(2021);
var totalCount = <?php echo $count?>;
var totalK= <?php echo $k?>;
for(var rCount=1; rCount<=totalCount; rCount++){
for(var cCount=1; cCount<=totalK; cCount++){
var key =$("#shift_date_"+rCount+"_"+cCount).val();
var existingShiftValues= jsonArrayShiftData[key];
if(existingShiftValues!=null && existingShiftValues!=undefined && existingShiftValues !=""){
$("#shift_status_"+rCount+"_"+cCount).val(existingShiftValues.split(',')).trigger("chosen:updated");
}
}
}
});*/
</script>