<?php
require_once('dbconnection.php');
session_start();
$q2="SELECT 
    student.s_name,
    payments.p_id,
    payments.class_time,
    payments.p_amount,
    payments.p_status,
    payments.start_date,
    payments.end_date,
    course_type.c_name,
    loan.borrow_amount,
    discount.d_amount,
    teacher.t_name
FROM 
    payments
INNER JOIN student ON payments.s_id = student.s_id
INNER JOIN course_type ON payments.c_id = course_type.c_id
INNER JOIN loan ON payments.s_id = loan.s_id AND payments.c_id = loan.c_id AND payments.t_id = loan.t_id
LEFT JOIN discount ON payments.s_id = discount.s_id AND payments.c_id = discount.c_id AND payments.t_id = discount.t_id
LEFT JOIN teacher ON payments.t_id = teacher.t_id";
$r=$con->query($q2);


?>
<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="keywords" content="admin, dashboard">
	
	<meta name="robots" content="index, follow">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	
	
	<!-- PAGE TITLE HERE -->
	<title>لیست محصلین</title>
	
	<!-- FAVICONS ICON -->
	<link rel="shortcut icon" type="image/png" href="images/favicon.png">
	
	<link href="vendor/jquery-nice-select/css/nice-select.css" rel="stylesheet">
	<link rel="stylesheet" href="vendor/nouislider/nouislider.min.css">
	<!-- Style css -->
    <link href="css/style.css" rel="stylesheet">
    <link href="vendor/sweetalert2/dist/sweetalert2.min.css" rel="stylesheet">
		<link href="vendor/jquery-nice-select/css/nice-select.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link rel="stylesheet" href="dist/sweetalert.css"> 
	
    <link href="vendor/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
     <script>
  document.addEventListener("keydown", function(event) {
    if (event.key === "Escape") {
      // Use a short delay to ensure smooth behavior
      setTimeout(() => {
        window.history.back();
      }, 100);
    }
  });
</script>
</head>
<body>

    <!--*******************
        Preloader start
    ********************-->
    <div id="preloader">
        <div class="waviy">
        <span style="--i:1">N</span>
		   <span style="--i:2">A</span>
		   <span style="--i:3">I</span>
		   <span style="--i:4">M</span>
		   <span style="--i:5">-</span>
		   <span style="--i:5">A</span>
		   <span style="--i:5">R</span>
		   <span style="--i:6">I</span>
           <span style="--i:6">A</span>
		   <span style="--i:7">-</span>
           <span style="--i:8">E</span>
		   <span style="--i:9">D</span>
           <span style="--i:10">U</span>
		</div>
    </div>
    <!--*******************
        Preloader end
    ********************-->

    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

        <!--**********************************
            Nav header start
        ***********************************-->
        <div class="nav-header">
            <a href="index.html" class="brand-logo">
            <img src="images/logo1.png" alt="" height="70" width="70">
            </a>
            <div class="nav-control">
                <div class="hamburger">
                    <span class="line"></span><span class="line"></span><span class="line"></span>
                </div>
            </div>
        </div>
        <!--**********************************
            Nav header end
        ***********************************-->
		
		<!--**********************************
            Chat box start
        ***********************************-->

		<!--**********************************
            Chat box End
        ***********************************-->
		
		<!--**********************************
            Header start
        ***********************************-->
        <div class="header">
            <div class="header-content">
                <nav class="navbar navbar-expand">
                    <div class="collapse navbar-collapse justify-content-between">
                        <div class="header-left">
							<div class="dashboard_bar">
                لیست محصلین
                            </div>
                        </div>
                      
                    </div>
				</nav>
			</div>
		</div>
        <!--**********************************
            Header end ti-comment-alt
        ***********************************-->

        <!--**********************************
            Sidebar start
        ***********************************-->
    	<div class="dlabnav">
            <div class="dlabnav-scroll">
				<ul class="metismenu" id="menu">
					<li class="dropdown header-profile">
						<a class="nav-link" href="javascript:void(0);" role="button" data-bs-toggle="dropdown">
							<img src="images/profile/profile.png" width="20" alt="">
							<div class="header-info ms-3">
								<span class="font-w600 "><?php echo $_SESSION['emp_name']; ?></span>
								<small class="text-end font-w400"><?php echo $_SESSION['emp_email']; ?></small>
							</div>
						</a>
						<div class="dropdown-menu dropdown-menu-end">
							<a href="app-profile.php" class="dropdown-item ai-icon">
								<svg id="icon-user1" xmlns="http://www.w3.org/2000/svg" class="text-primary" width="18" height="18" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
								<span class="ms-2">پروفایل</span>
							</a>
							<a href="logout.php" class="dropdown-item ai-icon">
								<svg id="icon-logout" xmlns="http://www.w3.org/2000/svg" class="text-danger" width="18" height="18" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>
								<span class="ms-2">خروج از سیتم </span>
							</a>
						</div>
					</li>
              
					<li><a class="ai-icon" href="index.php" aria-expanded="false" style='font-size:20px;font-weight: bold;'>
						<i class="flaticon-025-dashboard"></i>
						<span class="nav-text">صفحه اصلی</span>
					</a>
				
				</li>
                    <li><a class="has-arrow ai-icon" href="javascript:void()" aria-expanded="false" style='font-size:20px;font-weight: bold;'>
						<i class="icon-user"></i>
							<span class="nav-text">لیست محصلین</span>
							
						</a>
                        <ul aria-expanded="false">
                            <li><a href="add_student.php" style='font-size:20px;font-weight: bold;'>اضافه محصل</a></li>
							<li><a href="view_student.php" style='font-size:20px;font-weight: bold;'>مشاهده محصل</a></li>
							<li><a href="view_all_student.php" style='font-size:20px;font-weight: bold;'>مشاهده محصلین</a></li>
							
                        </ul>
                    </li>
                  

  
                    <li><a class="has-arrow ai-icon" href="javascript:void()" aria-expanded="false">
							<i class="fa fa-book"></i>
							<span class="nav-text" style='font-size:20px;font-weight: bold;'>بخش صنف</span>
						</a>
                        <ul aria-expanded="false">
							<li><a href="add_course.php" style='font-size:20px;font-weight: bold;'>اضافه صنف جدید </a></li>
							<li><a href="view_course.php" style='font-size:20px;font-weight: bold;'>مشاهده صنوف</a></li>

                        </ul>
                    </li>
					<li><a class="has-arrow ai-icon" href="javascript:void()" aria-expanded="false" style='font-size:20px;font-weight: bold;'>
						<i class="icon-user"></i>
							<span class="nav-text">بخش اساتید</span>
							
						</a>
                        <ul aria-expanded="false">
                            <li><a href="view_teacher.php" style='font-size:20px;font-weight: bold;'>مشاهده</a></li>
							
							
                        </ul>
                    </li>
					<li><a  class="has-arrow ai-icon" aria-expanded="false">
							<i class="fa fa-file-invoice-dollar"></i>
							<span class="nav-text" style='font-size:20px;font-weight: bold;'>بخش پول صیف</span>
						</a>
						<ul aria-expanded="false">
                            
                            <li><a href="view_cash_point_details.php" style='font-size:20px;font-weight: bold;'>راپور صیف</a></li>
							<li><a href="add_view_expenses.php" style='font-size:20px;font-weight: bold;'>اضافه و مشاهده مصارف</a></li>
							
							
                        </ul>
					</li>

					<li><a  class="has-arrow ai-icon" aria-expanded="false">
							<i class="fa fa-calendar"></i>
							<span class="nav-text" style='font-size:20px;font-weight: bold;'>مشاهده راپور ها</span>
						</a>
						<ul aria-expanded="false">
                            
                            <li><a href="cash_point_report.php" style='font-size:20px;font-weight: bold;'>راپور صیف</a></li>
							<li><a href="student_report.php" style='font-size:20px;font-weight: bold;'>راپور محصلین</a></li>

							
                        </ul>
					</li>

                </ul>
			<div class="copyright">
					<p><strong>Student MIS Admin Dashboard</strong> © 2025 All Rights Reserved</p>
					<p class="fs-12">Made with <span class="heart"></span> by Dynamic & Cryptic</p>
				</div>
			</div>
        </div>
        <!--**********************************
            Sidebar end
        ***********************************-->


		
		<!--**********************************
            Content body start
        ***********************************-->
		<div class="content-body">
            <div class="container-fluid">
				<div class="row page-titles">
					<ol class="breadcrumb">
						<li class="breadcrumb-item active"><a href="javascript:void(0)">صفحه</a></li>
						<li class="breadcrumb-item"><a href="javascript:void(0)">مشاهده محصل</a></li>
					</ol>
                </div>
				
            	<div class="col-12">
                        <div class="card">
                            <div class="card-header">
                               <!--- <h4 class="card-title">Profile Datatable</h4>   --->
                            </div>
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table id="example3" class="display" style="min-width: 845px" dir="rtl">
                                        <thead>
                                            <tr>
                                                <th style="font-size:20px;">نمبر</th>
                                                <th style="font-size:20px;">اسم محصل</th>
                                                <th style="font-size:20px;">صنف</th>
                                                <th style="font-size:20px;">مدرس</th>
                                                <th style="font-size:20px;">تایم</th>
                                                <th style="font-size:20px;">فیس</th>
                                                <th style="font-size:20px;">تخفیف</th>
                                                <th style="font-size:20px;">تاریخ شروع</th>
                                                <th style="font-size:20px;">تاریخ ختم</th>
                                                <th style="font-size:20px;">مبلغ باقی</th>
                                                <th style="font-size:20px;">حالت</th>
                                                
                                              
                                                
                                             
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <tr>
    <?php
            while($row=$r->fetch_array(MYSQLI_ASSOC))
            {

                echo "<td style='font-size:20px;'>".$row["p_id"]."</td>";
                echo "<td style='font-size:20px;'>".$row["s_name"]."</td>";
                echo "<td style='font-size:20px;'>".$row["c_name"]."</td>";
                echo "<td style='font-size:20px;'>".$row["t_name"]."</td>";
                echo "<td style='font-size:20px;'>".$row["class_time"]."</td>";
                echo "<td style='font-size:20px;'>".$row["p_amount"]."</td>";
                echo "<td style='font-size:20px;'>".$row["d_amount"]."</td>";
                echo "<td style='font-size:20px;'>".$row["start_date"]."</td>";
                echo "<td style='font-size:20px;'>".$row["end_date"]."</td>";
                echo "<td style='font-size:20px;'>".$row["borrow_amount"]."</td>";
                echo "<td style='font-size:20px;'>".$row["p_status"]."</td>";
                
            
            
                
                
                echo "</tr>";
            }
                    ?>									
    </tr>
    
                                        </tbody>
                                    </table>
                                            <!-- Button trigger modal -->
                                            
                                    <!-- Modal -->
                                   
                                    
                                    
                
                                    <div class="modal fade" id="exampleModalCenter">
                                        <div class="modal-dialog modal-dialog-centered" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h5 class="modal-title">Update Customer</h5>
                                                    <button type="button" class="btn-close" data-bs-dismiss="modal">
                                                    </button>
                                                </div>
                                                <div class="modal-body">
                                                  <form>
                                                  <label class="col-sm-6 col-form-label">Customer Name</label>
                                            <div class="col-sm-10">
                                                <input type="text" name="cust_name" id="cust_name"  class="form-control">
                                            </div>  
                                            
                                            <label class="col-sm-6 col-form-label">Customer Contact</label>
                                            <div class="col-sm-10">
                                                <input type="text" name="cust_contact" id="cust_contact"  class="form-control">
                                            </div>
                                            <label class="col-sm-6 col-form-label">Customer Address</label>
                                            <div class="col-sm-10">
                                                <input type="text" name="cust_add" id="cust_add"  class="form-control">
                                            </div>  
                                                  </form>
                                                </div>
                                                <div class="modal-footer">
                                                <input type="hidden" name="id_modal" id="id_modal" class="form-control-sm">
                                                    <button type="button" class="btn btn-danger light" data-bs-dismiss="modal">Close</button>
                                                    <button type="button" id="update_detail" class="btn btn-primary">Update</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
			
            </div>
        </div>
        <!--**********************************
            Content body end
        ***********************************-->
		


		
		
        <!--**********************************
            Footer start
        ***********************************-->
    <div class="footer">
		
            <div class="copyright">

            </div>
        </div>
        <!--**********************************
            Footer end
        ***********************************-->

		


	</div>
    <!--**********************************
        Main wrapper end
    ***********************************-->

    <!--**********************************
        Scripts
    ***********************************-->
    <!-- Required vendors -->
    <script src="vendor/global/global.min.js"></script>
	<script src="vendor/chart.js/Chart.bundle.min.js"></script>
	<script src="vendor/jquery-nice-select/js/jquery.nice-select.min.js"></script>
	
	
	
	<!-- Dashboard 1 -->
	<script src="js/dashboard/dashboard-1.js"></script>
    <script src="js/custom.min.js"></script>
	<script src="js/dlabnav-init.js"></script>
	<script src="js/demo.js"></script>
    <script src="js/styleSwitcher.js"></script>
    <!--Sweet Alert--->
    <script src="vendor/sweetalert2/dist/sweetalert2.min.js"></script>
    <script src="js/plugins-init/sweetalert.init.js"></script>
    <script src="dist/sweetalert.min.js"></script>
	<script src="vendor/jquery-nice-select/js/jquery.nice-select.min.js"></script>
	
    <script src="vendor/datatables/js/jquery.dataTables.min.js"></script>
    <script src="js/plugins-init/datatables.init.js"></script>
</body>
</html>
