<?php include_once('database_connection.php');
if(isset($_SESSION['Picture']) && $_SESSION['Picture']!="")
{
    $picture="images/".$_SESSION['Picture'];
}
else
{
$picture="assets/images/user/user.png";
}
/*    // define the path and name of cached file
    $cachefile = ''.date('M-d-Y').'.html';
    // define how long we want to keep the file in seconds. I set mine to 5 hours.
    $cachetime = 18000;
    // Check if the cached file is still fresh. If it is, serve it up and exit.
    if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
    include($cachefile);
        exit;
    }
    // if there is either no file OR the file to too old, render the page and capture the HTML.
    ob_start();
*///$StartDate=$_SESSION['StartDate'];


?>
<?php 


if(isset($_SESSION['userid']))
{
/*$StartDate=$_SESSION['StartDate'];
$EndDate=$_SESSION['EndDate'];*/
/*if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); 
*///echo "here";
$Userid=$_SESSION['userid'];//10;
?>
<?php include_once('headerindex.php');?>
 <style type="text/css" media="print">
 @media print {
    .page-main-header, #Footer { display: none !important; }
}
@media print {
    body{
        margin:0px !important;
        padding: 0px;
    }
.page-main-header, .hide { visibility: hidden !important;}
}
@media print
   {
    body{
        margin:0px !important;
                padding: 0px;
    }
      .noprint { display: none; }
    }
            
  </style>


<body>

<!-- Loader starts -->

<!-- Loader ends -->

<!--page-wrapper Start-->
<div class="page-wrapper">
<iframe src="#" name="download" height="0" width="0" id="download"></iframe>
    <!--Page Header Start-->
    <div class="page-main-header noprint">
        <div class="main-header-left">
            <div class="logo-wrapper">
                <a href="<?php echo SITEURL;?>index.php">
                    <img src="<?php echo SITEURL;?>assets2/images/its-logo-vision.png" width=150 class="image-dark" alt=""  style="margin-left:9px;height:75px !important">
                    <img src="<?php echo SITEURL;?>assets2/images/its-logo-invert.png" class="image-light" alt="">
                </a>
            </div>
        </div>
        <div class="main-header-right row noprint">
            <div class="mobile-sidebar">
                <div class="media-body text-right switch-sm">
                    <label class="switch">
                        <input type="checkbox" id="sidebar-toggle" checked="">
                        <span class="switch-state"></span>
                    </label>
                </div>
            </div>
            <div class="nav-right col noprint">
                <ul class="nav-menus">
                    <div style="width: 80%;text-align: left;">
                    <li id="menuList" class="custom-scrollbar slim" style="a: left;margin: 0;padding: 0;max-height: 40px;list-style-type: none;max-height: 100%;overflow: hidden;display: inline-block;overflow-x:auto;width: 100%;/* max-width:500px; display: grid;">

                        <ul class="nav nav-pills custom-scrollbar slim" id="pills-icontab" role="tablist" style="margin: 0;padding: 0;/* max-height: 40px; *//* list-style-type: none; */line-height: 26px;/* max-height: 40px; */overflow: hidden;display: inline-block;white-space: nowrap;overflow-x:auto;position:relative;">
                            
                            <li class="nav-item">
                                <a class="nav-link active" id="pills-0-tab" data-toggle="pill" href="<?php echo SITEURL;?>index.php#pills-0" role="tab" aria-controls="pills-0" aria-selected="false">
                                    <i class="icon-desktop icon-sidebar" style="margin-left:0px;margin-right:5px;font-size:10px"></i>Dashboard<i class="icon-close" onclick="closeTab(this,&#39;0&#39;)" style="margin-left:5px;margin-right:0px;font-size:10px"></i>
                                </a>
                            </li>
                
                            
                        </ul>


                    </li>
                

                    </div>
<!-- 
                    <li >
                        <form class="form-inline search-form">
                            <div class="form-group">
                                <label class="sr-only">Email</label>
                                <input type="search"  class="form-control-plaintext" placeholder="Search.." >
                                <span class="d-sm-none mobile-search">
                                </span>
                            </div>
                        </form>
                    </li>
                
                     -->
<li>
                        <a href="<?php echo SITEURL;?>index.php#!" onclick="javascript:toggleFullScreen()" class="text-dark">
                            <img class="align-self-center pull-right mr-2" src="<?php echo SITEURL;?>assets2/images/browser.png" alt="header-browser">
                        </a>
                    </li>
                    <!-- <li class="onhover-dropdown">
                        <a href="#!" class="txt-dark">
                            <img class="align-self-center pull-right mr-2" src="./assets2/images/dashboard/translate.png" alt="header-translate">
                        </a>
                        <ul class="language-dropdown onhover-show-div p-20">
                     <li>
                                <a href="#" data-lng="en">
                                    <i class="flag-icon flag-icon-ws"></i> English
                                </a>
                            </li>
<li>
                                <a href="#" data-lng="es">
                                    <i class="flag-icon flag-icon-va"></i> Spanish
                                </a>
                            </li>
<li>
                                <a href="#" data-lng="pt">
                                    <i class="flag-icon flag-icon-id"></i> Portuguese
                                </a>
                            </li>
<li>
                                <a href="#" data-lng="fr">
                                    <i class="flag-icon flag-icon-fr"></i> French
                                </a>
                            </li>
                          </ul>
                    </li>
                     -->

                    <li class="onhover-dropdown">
                        <a href="<?php echo SITEURL;?>index.php#!" class="txt-dark">
                            <img class="align-self-center pull-right mr-2" src="<?php echo $picture;?>" alt="header-notification" width=30 height=30 style="border-color:gray;">
                            <span class="badge badge-pill badge-primary notification"></span>
                        </a>
                        <ul class="notification-dropdown onhover-show-div">
<li>Notification <span class="badge badge-pill badge-secondary text-white text-uppercase pull-right">0 New</span></li>
<!--
<li>
                                <div class="media">
                                    <i class="align-self-center notification-icon icofont icofont-shopping-cart bg-primary"></i>
                                    <div class="media-body">
                                        <h6 class="mt-0">Your order ready for Ship..!</h6>
                                        <p class="mb-0">Lorem ipsum dolor sit amet, consectetuer elit.</p>
                                        <span><i class="icofont icofont-clock-time p-r-5"></i>Just Now</span>
                                    </div>
                                </div>
                            </li>
                        
<li>
                                <div class="media">
                                    <i class="align-self-center notification-icon icofont icofont-download-alt bg-success"></i>
                                    <div class="media-body">
                                        <h6 class="mt-0 txt-success">Download Complete</h6>
                                        <p class="mb-0">Lorem ipsum dolor sit amet, consectetuer elit.</p>
                                        <span><i class="icofont icofont-clock-time p-r-5"></i>5 minutes ago</span>
                                    </div>
                                </div>
                            </li>
                        
<li>
                                <div class="media">
                                    <i class="align-self-center notification-icon icofont icofont-recycle bg-danger"></i>
                                    <div class="media-body">
                                        <h6 class="mt-0 txt-danger">250 MB trush files</h6>
                                        <p class="mb-0">Lorem ipsum dolor sit amet, consectetuer elit.</p>
                                        <span><i class="icofont icofont-clock-time p-r-5"></i>25 minutes ago</span>
                                    </div>
                                </div>
                            </li>
     
                            <li class="text-center">You have Checked <a href="<?php echo SITEURL;?>index.php#">all</a> notification  </li>
                        
                        </ul>

                    </li>
                
                    <li class="onhover-dropdown">
                        <div class="media  align-items-center">
                            <img class="align-self-center pull-right mr-2" src="<?php echo SITEURL;?>assets2/images/user.png" alt="header-user">
                            <div class="media-body">
                                <h6 class="m-0 txt-dark f-16">
                                    
                                    <i class="fa fa-angle-down pull-right ml-2"></i>
                                </h6>
                          
-->
<li>
                                <a href="<?php echo SITEURL;?>index.php#">
                                    <i class="icon-lock"></i>
                                    </a><a href="<?php echo SITEURL;?>index.php#" onclick="changePassword()">Change Password</a>
                                
                            </li>
                        
<li>
<a href="<?php echo SITEURL;?>index.php#" onclick="changePasscode()">                                    <i class="icon-key"></i>
                                    Change PassCode
                                </a>
                            </li>
                        
<li>
<a href="<?php echo SITEURL;?>index.php#" onclick="editProfile()">
                                    <i class="icon-check-box"></i>
                                    Edit Profile
                                </a>
                            </li>
                        
<!-- <li>
                                <a href="#">
                                    <i class="icon-comments"></i>
                                    Chat
                                </a>
                            </li>
 -->                          
<li>
                                <a href="<?php echo SITEURL;?>index.php#">
                                    <i class="icon-power-off"></i>
                                    </a><a href="#" onclick="formlogout()">Logout</a>
                                
                            </li>
                        
                        </ul>
                    </li>
                               </ul>
                <div class="d-lg-none mobile-toggle">
                    <i class="icon-more"></i>
                </div>
            </div>
        </div>
    </div>
    <!--Page Header Ends-->

    
    <!--Page Body Start-->
    <div class="page-body-wrapper" style="padding-left:0px!important;padding-right:0px!important">
        <!--Page Sidebar Start-->
        <div class="page-sidebar custom-scrollbar  navigation-bordered">
            <div class="sidebar-user text-center">
                <div>
                    <!-- <img class="img-50 rounded-circle" src="./assets2/images/custom/its-logo.png" alt="#"> -->
                    <img class="img-100 rounded-circle" src="<?php echo $picture;?>" alt="#">

                </div>
                <h6 class=" f-12" id="fullname" style="text-transform: capitalize;font-weight:bold;margin: 0px;padding-bottom: 0px;padding-top: 10px;font-size: 15px;"><?php if(isset($_SESSION['fullname']))echo  $_SESSION['fullname'];?></h6>
                <h6 class="mt-1 f-12" id="user_name" style="text-transform: lowercase;color:black;margin:2px;font-weight:bold;padding-bottom: 0px;"><?php echo  $_SESSION['UserName'];?></h6>
            </div>
            <ul class="sidebar-menu" id="main-page-sidebar">
                
<!-- 

<li>
                    <div class="sidebar-title">General</div>
                    <a href="sample-page.html" class="sidebar-header">
                        <i class="icon-file"></i><span> Sample page</span>
                    </a>
                </li>
 -->

                
                <li class="active">
                    
                    <a href="index.php" onclick="javascript:navigateTo(this,&#39;./dashboard.html&#39;,&#39;Dashboard&#39;,0)" class="sidebar-header active">
                        <i class="icon-desktop icon-sidebar"></i><span class="sub-header-title">DASHBOARD</span>
                    </a>
                </li>
 <?php 
include('sidebar.php');

?>
</ul>
<?php 

foreach ($_SESSION['SETTING'] as $key => $value) {
    # code...
echo '<input type="hidden" title="'.$key.'" name="'.$key.'" id="'.$key.'" value="'.$value.'">';    
}
?>


<input type="hidden" name="gender" id="gender" value="">
<input type="hidden" name="phone" id="phone" value="">
<input type="hidden" name="fullname" id="fullname" value="">
<input type="hidden" name="StartDate" id="StartDate" value="">
<input type="hidden" name="EndDate" id="EndDate" value="">
<input type="hidden" name="CompanyID" id="CompanyID" value="<?php echo $_SESSION['CompanyID']; ?>">
<input type="hidden" name="PassCode" id="PassCode" value="123">
            <div class="sidebar-widget text-center noprint">
                <div class="sidebar-widget-top">
                    <h6 class="mb-2 fs-14">Need Help</h6>
                    <i class="icon-bell"></i>
                </div>
                <div class="sidebar-widget-bottom p-1 m-10">
                    <p>
                        <br>
                        <!-- <br>ITSUPPORT@ALMUTAKAMELA.AE -->
                        <!-- <br><a href="#">Visit FAQ</a> -->
                    </p>
                </div>
            </div>
        </div>
        <!--Page Sidebar Ends-->

        <div class="page-body" style="padding-left:0px!important;padding-right:0px!important">

            <div class="tab-content" id="pills-icontabContent">
                <div class="tab-pane fade show active" id="pills-0" role="tabpanel" aria-labelledby="pills-0-tab" id="frame_body">
                    <!-- http://mutakamela.ddns.net:53556/-->
                    <iframe src="pages/dashboard-statistics3.html" class="container-fluid" style="position:absolute; overflow:hidden; height:100%;border:none;padding-right:0px!important;padding-left:0px!important;" id="frame_body1w" name="frame_body1w"></iframe>
                </div>

            </div>
            



                
        </div>
        <!--Page Body Ends-->
    </div>
    <!--Page Body Ends-->

</div>
<!--page-wrapper Ends-->
<!--Passcode modal-->
    <div class="modal fade" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"
        id="PassCodeModal">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
            <?php include_once('login2.html');?>    
            </div>
        </div>
    </div>
<?php include_once('footerindex.php');?>

</body></html>
<Script>
     $(document).ready(function(){
$(".mastermenu").hide();
        $("a.topmenu").click(function(){
  var sub=($(this).attr('ID'));
  $("li."+sub).slideToggle();
})
    })
    function d2h(d) { return (+d).toString(16).toUpperCase(); }
     function checkSalesManInfo()
    {


        var resp=0;
$.ajax({


                url: globalWebServiceInventoryPath + 'ajaxdata.php?action=SalesManInfo',

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: '',
         
                success: function (data) {

                       //        alert('resp='+data);
 
                },
                error: function (jqXHR, textStatus) {
    //$('#PassCodeModal').modal('show');
                  /*  $.notify({ message: "Error, please check your internet connection status!" }, alertTypeCritical);*/
                }, complete: function () {
                   // $(form).find(":submit").prop("disabled", null);
                   console.log('complete');
                }
            
            });
     
        
    }
    function checkSalesInvoice()
    {


        var resp=0;
$.ajax({


                url: globalWebServiceInventoryPath + 'ajaxdata.php?action=GenerateVoucher',

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: '',
         
                success: function (data) {

                       //        alert('resp='+data);
 
                },
                error: function (jqXHR, textStatus) {
    //$('#PassCodeModal').modal('show');
                  /*  $.notify({ message: "Error, please check your internet connection status!" }, alertTypeCritical);*/
                }, complete: function () {
                   // $(form).find(":submit").prop("disabled", null);
                   console.log('complete');
                }
            
            });
     
        
    }
        function checkInvoice()
        {

        var resp=0;
$.ajax({


                url: globalWebServiceInventoryPath + 'getjobcard.php?action=GeneratePurchaseInvoiceAll',

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: '',
         
                success: function (data) {

                       //        alert('resp='+data);
 
                },
                error: function (jqXHR, textStatus) {
    //$('#PassCodeModal').modal('show');
                  /*  $.notify({ message: "Error, please check your internet connection status!" }, alertTypeCritical);*/
                }, complete: function () {
                   // $(form).find(":submit").prop("disabled", null);
                   console.log('complete');
                }
            
            });

/*            $request_textbox.then(function (data) {
                alert('resp='+data);
                if(data==1 || data==true)
        {
            //session active
        }
        else
        {
    $('#PassCodeModal').modal('show');
            //logout
        }
            });

*/           
        }
    function checksession()
    {
        var resp=0;
$.ajax({


                url: globalWebServiceInventoryPath + 'ajaxdata.php?action=checkusersession',

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: '',
         
                success: function (data) {

                       //        alert('resp='+data);
 
                },
                error: function (jqXHR, textStatus) {
    //$('#PassCodeModal').modal('show');
                  /*  $.notify({ message: "Error, please check your internet connection status!" }, alertTypeCritical);*/
                }, complete: function () {
                   // $(form).find(":submit").prop("disabled", null);
                   console.log('complete');
                }
            
            });

/*            $request_textbox.then(function (data) {
                alert('resp='+data);
                if(data==1 || data==true)
        {
            //session active
        }
        else
        {
    $('#PassCodeModal').modal('show');
            //logout
        }
            });

*/    }
    $('#PassCodeModal').modal('hide');
    window.setInterval(function(){
        //check session
        var res=checksession();
       // alert(res);
        
    },30000);
    window.setInterval(function(){
        //check session
        var res=checkInvoice();
       // alert(res);
        
    },1200000);
    
    window.setInterval(function(){
        //check session
        var res=checkSalesManInfo();
       // alert(res);
        
    },3000000);

    window.setInterval(function(){
        //check session
        var res=checkSalesInvoice();
       // alert(res);
        
    },1000000);
    function fresh()
    {
      //  window.frames['frame_body1w'].location.reload();
$('#frame_body1w').html('');
        var iframe = document.getElementById('frame_body1w');
        var temp=iframe.src;
iframe.src ='';
 iframe.src=temp+'&refresh='+Math.random()*100;
 //alert(temp);
//    document.getElementById('frame_body1w').contentDocument.location.replace(temp);
    $('#frame_body1w').attr('src',$('#frame_body1w').attr('src'));// $('#frame_body1w').attr('src'));

    }
    /*document.getElementById('PassCode').value=<?php //echo $_SESSION['PassCode'];?>;
    document.getElementById('StartDate').value='<?php //echo $_SESSION['StartDate'];?>';
    document.getElementById('fullname').value='<?php //echo $_SESSION['fullname'];?>';
    document.getElementById('phone').value='<?php //echo $_SESSION['phone'];?>';        
    document.getElementById('EndDate').value='<?php //echo $_SESSION['EndDate'];?>';*/
   // alert(document.getElementById('StartDate').value);
    //document.getElementById('PassCode').value=<?php //echo $_SESSION['PassCode'];?>            
//localstorage.setItem('PassCode',<?php //echo $_SESSION['PassCode'];?>);
    </Script>
<?php

/*    // We're done! Save the cached content to a file
    $fp = fopen($cachefile, 'w');
    fwrite($fp, ob_get_contents());
    fclose($fp);
    // finally send browser output
    ob_end_flush();*/
}
else
{
  //  echo "here";
    echo "<script>window.location='login.html';</script>";
}
?>