<style>.top-bar-minimize{display:none;}
thead, tfoot {display: table-header-group;}
.top-bar+.well,.accordion .accordion-heading+.accordion-body{display: inline-block !important;width: 100% !important;overflow: inherit !important;} .check{ width: 133px; padding: 5px; display: inline-block; border-right: 1px dotted;}
.check input[type="checkbox"] { margin: 0 6px;}
</style>
<?php
$pgMod="attendance";
$pgAct="view";
if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);

if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
if($pgAct=="edit" && $_GET["id"]!="")
{   
	$aryForm=$db->getRow("SELECT * FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET['id']."'");
}
else
{
	?>
<script>
function changeDay(){
	$(".holiday").html("H");
	$(".sunday").html("S");
	$(".absent").html("A");
	$(".leave").html("L");
}
$(document).ready(function(){
	getAttandencCalender()	
});
var root='<?php echo URL_ROOT; ?>';
function getAttandencCalender(){
	$("#CalenderAttandencDetail").html('<center><img src="'+root+'assets/icon/load.gif" /></enter>');
	var month=$("#bmonth").val();
	var year=$("#byear").val();
	var cla=$("#class").val();
	var section=$("#section").val();
	var page="late_student";
	$.post( "<?php echo URL_ROOT ?>Attandence/ajax.php", { type: "getAttandencCalenderStudent_late", page: page, month: month, year: year, class: cla, section: section, id: "<?php echo $_GET["id"] ?>" } , function( data ) {
	  	$("#CalenderAttandencDetail").html(data);
		changeDay();
	});
}
function addAttandenc_late(id,date,t){
	var vals=$(t).html();
	$(t).html('<img src="'+root+'assets/icon/load.gif" height="100%" />');
	var page="late_student";
	if($(t).hasClass('btn-success')){
		var month=$("#bmonth").val();
		var year=$("#byear").val();
		$.post( "<?php echo URL_ROOT ?>Attandence/ajax.php", { type: "addAttandencStudent_late",date:date, page:  page, month: month, year: year, id: id, status:'0' } , function( data ) {
			$(t).removeClass('btn-success');
			$(t).addClass('btn-default');
			$(t).html('L');
			//if(data!="")alert(data);
		});
	}else if($(t).hasClass('btn-default')){
		var month=$("#bmonth").val();
		var year=$("#byear").val();
		$.post( "<?php echo URL_ROOT ?>Attandence/ajax.php", { type: "removeAttandencStudent_late",date:date, page:page, month: month, year: year, id: id, status:'1' } , function( data ) {
			$(t).removeClass('btn-default');
			$(t).addClass('btn-success');
			$(t).html(date);
			//if(data!="")alert(data);
		});
	}
	else{
		alert("This is Holiday or already add Attandenc for this date")
	}
	$(t).html(vals);
}
</script>
	<div class="row-fluid"><div class="span12"><div class="top-bar">
    <h3><i class="icon-eye-open"></i> <?php echo ucwords($pgAct." ".$pgMod); ?></h3>
    <div style="float:right; width:228px; margin-top:5px">
            <button onclick="printDiv('CalenderAttandencDetail')" type="button" class="btn btn-primary">Print</button>
    </div>
    </div>
    <div class="well no-padding">
    <div class="control-group">
    <label class="control-label" for="rollno">Color Means :</label>
    <div class="controls">
     <button type="button" class="btn btn-danger">Sunday/Holiday</button>
    <button type="button" class="btn btn-default">Absent</button>
    <button type="button" class="btn btn-success">Present</button>
    </div><br />
<br />
		
        <label class="control-label" for="rollno">Class</label>
        <div class="controls">
            <select onchange="getAttandencCalender()" class="span6" name="class" id="class">
             <?php
			 	$clsses=$db->getRows("select * from class where school_id='".$_SESSION["admin"]["school_id"]."' and status=1");
                foreach($clsses as $cla){
					$clas=$cla["class"];
                    echo "<option $selected value='$clas'>$clas</option>"; 
                }
             ?> 
            </select>
            <select onchange="getAttandencCalender()" class="span6" name="section" id="section">
                <option value="">Section</option>
                <?php 
                    $class=$db->getRows("select * from section where school_id='".$_SESSION["admin"]["school_id"]."'");
                    foreach($class as $cla){
                        ?>
                        <option value="<?php echo $cla["name"] ?>">
                            <?php echo $cla["name"] ?>
                        </option>
                        <?php
            
                    }
                ?>
            </select>
        </div>
        <label class="control-label" for="rollno">Salery Month</label>
        <div class="controls">
            <select onchange="getAttandencCalender()" class="span6" name="bmonth" id="bmonth">
             <?php
                for($m = 1;$m <= 12; $m++){ 
                    $month =  date("F", mktime(0, 0, 0, $m));
                    $selected="";if($m == date("m", (time()))) $selected="selected"  ;
                    echo "<option $selected value='$m'>$month</option>"; 
                }
             ?> 
            </select>
            <?php
            $years=explode("-",$_SESSION["admin"]["session"]);
            if(is_array($years) && count($years)>0){
                ?><select onchange="getAttandencCalender()" class="span6" name="byear" id="byear"><?php
                foreach($years as $y){
                    echo "<option value='$y'>$y</option>"; 
                }
                ?></select><?php
            }
            ?>
       </div>
    </div>
    <div id="CalenderAttandencDetail">
	
    </div>
	</div></div></div>
	<?php
}
?>