<?php session_start();
require_once 'config.php';
require_once 'auth.php';
$PageName = "Profile";
$UserId = $_SESSION['User']['id'];
$user_id = $UserId;
$sql11 = "SELECT * FROM tbl_users WHERE id='$UserId'";
$row11 = getRecord($sql11);
$Name = $row11['Fname']." ".$row11['Lname'];
$Phone = $row11['Phone'];
$EmailId = $row11['EmailId'];
$ExpDate = date("d/m/Y", strtotime(str_replace('-', '/',$row11['Validity'])));

 ?>
<!doctype html>
<html lang="en" class="h-100">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="generator" content="">
   <title>Iways Skill India</title>

    <!-- manifest meta -->
    <meta name="apple-mobile-web-app-capable" content="yes">

    <!-- Favicons -->
    <link rel="apple-touch-icon" href="img/favicon180.png" sizes="180x180">
    <link rel="icon" href="img/favicon32.png" sizes="32x32" type="image/png">
    <link rel="icon" href="img/favicon16.png" sizes="16x16" type="image/png">

    <!-- Material icons-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    <!-- Google fonts-->
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&amp;display=swap" rel="stylesheet">

    <!-- swiper CSS -->
    <link href="vendor/swiper/css/swiper.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/style.css" rel="stylesheet" id="style">
</head>

<body class="body-scroll d-flex flex-column h-100 menu-overlay" data-page="homepage">
    <!-- screen loader -->
    


    <!-- menu main -->
     <?php include_once 'sidebar.php'; ?>



    <!-- Begin page content -->
    <main class="flex-shrink-0 main has-footer">
        <!-- Fixed navbar -->
        <?php include_once 'top_header.php'; ?>
    <br><br><br>
        <div class="main-container">
            <div class="container-fluid top-70 text-center mb-4">
            <div class="avatar avatar-140 rounded-circle mx-auto shadow">
                 <div class="background">
                    <?php 
                        if($row11['Photo'] == ''){
                     ?>
                    <img src="user_icon.jpg" alt="" style="width: 140px;height: 140px;">
                <?php } else  {?>
                     <img src="<?php echo $UploadUrl;?>/uploads/<?php echo $row11['Photo']; ?>" alt="" style="width: 140px;height: 140px;">
                 <?php } ?>
                </div>
            </div>
        </div>

       <div class="container mb-4 text-center text-black">
            <h6 class="mb-1"><?php echo $Name; ?></h6>
         
        </div>
            
           

            
            <div class="container mb-4">
              <div class="row mb-4">
                    <div class="col-5">
                        <a href="edit-profile.php"><button class="btn btn-outline-default px-2 btn-block rounded" style="font-size: 10px;"><span class="material-icons">account_circle</span> Edit Profile</button></a>
                    </div>
                    <div class="col-7">
                        <a href="change-password.php"><button class="btn btn-outline-default px-2 btn-block rounded" style="font-size: 10px;"> <span class="material-icons">lock_open</span> Change Password</button></a>
                    </div>
                </div>
              
            </div>

          
          
          
            <div class="container mb-4">
                <div class="card">
                    <div class="card-body text-center ">
                        <div class="row justify-content-equal no-gutters">
                            
                            <div class="col-4 col-md-2 mb-3">
                                <a href="edit-profile.php" class="icon icon-50 rounded-circle mb-1 bg-default-light text-default"><span class="material-icons">settings</span></a>
                                <p class="text-secondary"><small>Account Details</small></p>
                            </div>
                            <div class="col-4 col-md-2 mb-3">
                                <a href="change-password.php" class="icon icon-50 rounded-circle mb-1 bg-default-light text-default"><span class="material-icons">lock_open</span></a>
                                <p class="text-secondary"><small>Change Password</small></p>
                            </div>
                            <div class="col-4 col-md-2 mb-3">
                                <a href="JavaScript:Void(0);" onclick="logout()" class="icon icon-50 rounded-circle mb-1 bg-default-light text-default"><span class="material-icons">power_settings_new</span></a>
                                <p class="text-secondary"><small>Logout</small></p>
                            </div>
                        </div>
                       
                    </div>
                </div>
            </div>

            
            <div class="main-container">
            <div class="container">
                <div class="card">
                    <div class="card-body px-0">
                        <ul class="list-group list-group-flush">
                            <?php 
            $i=1;
            $sql2 = "SELECT tac.*,tc.Name As Course,tc.Photo FROM tbl_allocate_courses tac LEFT JOIN tbl_courses tc ON tac.CourseId=tc.id WHERE tac.Status=1 AND tac.CourseFees>0"; 
            $res2 = getList($sql2);
            foreach($res2 as $row){ ?>
                            <li class="list-group-item">
                                <div class="row align-items-center">
                                    <div class="col-auto pr-0">
                                        <div class="avatar avatar-40 rounded">
                                            <div class="background">
                                              <?php if($row["Photo"] == '') {?>
                                      <img src="no_image.jpg" style="width: 40px;height: 40px;"> 
                                      <?php } else if(file_exists($UploadUrl.'/uploads/'.$result["Photo"])){?>
                                      <img src="<?php echo $UploadUrl;?>/uploads/<?php echo $row["Photo"];?>" style="width: 40px;height: 40px;">
                                      <?php }  else{?>
                                      <img src="no_image.jpg" style="width: 40px;height: 40px;"> 
                                      <?php } ?>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col align-self-center pr-0">
                                        <h6 class="font-weight-normal mb-1" style="font-size: 12px;"><?php echo $row['Course'];?></h6>
                                        <p class="small text-secondary"><?php echo date("d-m-Y", strtotime(str_replace('-', '/',$row['CreatedDate'])));?></p>
                                    </div>
                                    <div class="col-auto">
                                        <h6 class="text-success">&#8377; <?php echo number_format($row['CourseFees'],2);?></h6>
                                    </div>
                                </div>
                            </li>
                             <?php } ?>
                           
                           
                        </ul>
                    </div>
                </div>
            </div>
        </div>
           
            
        </div>
    </main>

    <?php include_once 'footer.php';?>


    <!-- color settings style switcher -->
    



    <!-- Required jquery and libraries -->
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- cookie js -->
    <script src="js/jquery.cookie.js"></script>

    <!-- Swiper slider  js-->
    <script src="vendor/swiper/js/swiper.min.js"></script>

    <!-- Customized jquery file  -->
    <script src="js/main.js"></script>
    <script src="js/color-scheme-demo.js"></script>


    <!-- page level custom script -->
    <script src="js/app.js"></script>
    
     <script>
        function logout(){
       Android.logout();
       window.location.href="logout.php";
  }
    </script>
</body>

</html>
