ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/home2/selectio/www/obnovit-tracking/old/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/home2/selectio/www/obnovit-tracking/old/ownattendance.php

<?php  include "header.php";
date_default_timezone_set("Asia/Kolkata");   //India time (GMT+5:30)
$cur_date= date('Y-m-d');

        $statement = $pdo->prepare("SELECT * FROM `tbl_attendance` where empid=".$_SESSION['hrm']['id']." and att_date='".$cur_date."'");
		$statement->execute(); 
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$total_rows = $statement->rowCount();


?>
<div class="content-wrapper" style="background:white;">
        <div class="col-lg-12 alerts">
        

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-header">
                    <h3 class="box-title"><b>Attendance Update : </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">
                        
                        
                        <div class="row">
                            <?php if($total_rows==0){ ?>
                            <div class="form-group" style="text-align:center;" id="checkin_div">
                                <button type="submit" name="add-leave-request" value="Check in Now"  class="btn btn-success" id="checkin_now" >Check in Now</button>
                            </div>
                        <?php }else{ ?>
                        
                            <div class="form-group" style="text-align:center;" id="checkout_div">
                                <button type="submit" name="add-leave-request" value=""  class="btn btn-warning" id="checkout_now">Check in Out</button>
                            </div>
                            <?php } ?>
                        </div>
                        
                        


                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $( document ).ready(function() {
        
         $("#checkin_now").click(function() {
              update_checkin_attendance();
            });
            $("#checkout_now").click(function() {
              update_checkout_attendance();
            });

        
        function update_checkin_attendance(){
            var emp_id=<?=$_SESSION['hrm']['id']?>;
                        $.ajax({
                            url: 'api/own-attendance-checkin-checkout.php',
                            type: 'post',
                            dataType: 'json',
                            data: {type:'update_checkin',emp_id:emp_id,created_by:emp_id},
                            success: function (response) {
                                    console.log(response);
                                    if(response['error']==false){
                                        alert(response['message']);
                                        location.reload();
                                    }else{
                                        alert(response['message']);
                                    }
                          
                                }
                        });
        }
        function update_checkout_attendance(){
            var emp_id=<?=$_SESSION['hrm']['id']?>;
                        $.ajax({
                            url: 'api/own-attendance-checkin-checkout.php',
                            type: 'post',
                            dataType: 'json',
                            data: {type:'update_checkout',emp_id:emp_id,updated_by:emp_id},
                            success: function (response) {
                                    console.log(response);
                                    if(response['error']==false){
                                        alert(response['message']);
                                        location.reload();
                                    }else{
                                        alert(response['message']);
                                    }
                          
                                }
                        });
        }
    });
</script>

<?php include "footer.php";?>

Zerion Mini Shell 1.0