<?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; }
    }
            
.nav-pills .nav-link.active, .nav-pills .show > .nav-link
{
    background: #fff !important;
    color:blue !important;
}            
  </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=190 class="image-dark" alt=""  style="height:55px !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" style="border:red 0px solid;width:5.3%;">
                <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="margin-left:0px;padding-left:0px;width: 90%;text-align: left;border:red 0px solid;">
                    <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" style="background: none;color:blue;">
                                <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">
                                    Dashboard
                                </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" style="background-color:linear-gradient(#f6f7fb 99%,#fff);">
            <div class="sidebar-user text-center" style="">
                <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:1px;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>
                <i class="icon-desktop icon-sidebar"></i>
 -->

                
                <li class="active">
                    
                    <a href="index.php" style="color:black;" onclick="javascript:navigateTo(this,&#39;./dashboard.html&#39;,&#39;Dashboard&#39;,0)" class="sidebar-header active">
                        <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="userid" id="userid" value="<?php echo $_SESSION['userid'];?>">
<input type="hidden" name="myInput" id="myInput" 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="PassCode" id="PassCode" value="">
            <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>+971 (0)43 111 111 (Ext.111)
                        <br>itsupport@itscircle.com
                        <!-- <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;margin-top: 35px;margin-right: 0px;">

            <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-statistics.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('login2.html');?>    
            </div>
        </div>
    </div>
<?php include_once('footerindex.php');?>

</body></html>
<Script>
    function d2h(d) { return (+d).toString(16).toUpperCase(); }

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


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

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: $(this).serialize(document.forms[0]),
         
                success: function (data) {

                       //        alert('resp='+data);
 
                },
                error: function (jqXHR, textStatus) {
    //$('#PassCodeModal').modal('show');
    window.location='login.html';
                  /*  $.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);
        
    },500000);
    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'];?>);
  function myFunction(copydata) {
  /* Get the text field */
  document.getElementById("myInput").value=copydata;
  var copyText = document.getElementById("myInput");

  /* Select the text field */
  copyText.select();
 // copyText.setSelectionRange(0, 99999); /*For mobile devices*/

  /* Copy the text inside the text field */
  document.execCommand("copy");

  /* Alert the copied text */
  alert("Copied the text: " + copyText.value);
}
    </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>";
}
?>