<!DOCTYPE html>
<html lang="en">  
<head>
<?php ob_start(); ?>
<?php   require_once 'head_link.php'; ?>

</head>

<body>
 
<?php   require_once 'header1.php'; ?> 

<?php
 
	if(isset($_GET['delete_id']))
	{ 
		// it will delete an actual record from db
		$stmt_delete = $DB_con->prepare('DELETE FROM product WHERE product_id =:uid');
		$stmt_delete->bindParam(':uid',$_GET['delete_id']);
		$stmt_delete->execute();
		
		//header("Location:group.php");
	}

?>

<?php  require_once 'sidebar.php'; ?>

  <main id="main" class="main">

    <div class="pagetitle bg-light rounded p-2">
     <h1>Course List | <a target="_blank" href="course-print"><i class="bi bi-printer"></i></a> | <span> <a href="courses-add">   <i class="bi bi-plus-square-fill"></i> </a> </span> </h1>
    </div> 

    <section class="section">
      <div class="row">
	  
        <div class="col-lg-12">

          <div class="card">
            <div class="card-body">
             
             <table class="table table-hover datatable">
                        <thead class="alert-primary">
                        <tr>
                            <th>SL</th> 
							<th>Courses Name</th>							
							<th>Duration</th>							
							<th>Cost Price</th>								
							<th>Sale Price</th>	 
							<th><center>Edit</center></th>
							<th><center>Delete</center></th>
                        </tr>
                        </thead>
						
						
              <tbody id="tbody">
							<?php
								$eq=mysqli_query($con,"select * from product 
			 
								WHERE product.user_id='".$_SESSION['id']."' ORDER BY product.product_id asc ");
								while($eqrow=mysqli_fetch_array($eq)){
									$eidm=$eqrow['id'];
									?>
										<tr> 
											<td><?php echo ++$sl; ?></td> 
											<td><?php echo $eqrow['product_name']; ?></td>
											<td><?php echo $eqrow['product_details']; ?></td>
											<td><?php echo $eqrow['buy_rate']; ?></td>											
											 <td><?php echo $eqrow['retail_rate']; ?></td> 
											
											
				<td> <center>
				<!--
				<a  class="btn-sm btn-info" href="product-details-view?edit_id=<?php echo $eqrow['product_id']; ?>" title="click for edit"><span class="glyphicon glyphicon-edit"></span> Details</a>  
				<a  class="btn-sm btn-danger" href="edit-product-price?edit_id=<?php echo $eqrow['product_id']; ?>" title="click for edit"><span class="glyphicon glyphicon-edit"></span> Price</a> 
				<a  class="btn-sm btn-success" target="_blank" href="edit-product-qty?edit_id=<?php echo $eqrow['product_id']; ?>" title="click for edit" ><span class="glyphicon glyphicon-edit"></span> Qty</a> 
				-->  
				  <a  class="btn-sm btn-info" href="courses-update?update=<?php echo $eqrow['product_id']; ?>" title="click for update" ><span class="bi bi-pencil-square"></span> Edit</a> 
				 
				 </center>
				 </td>
				
				<td> 
					<a class="btn-sm btn-danger delete-btn" href="#"   data-id="<?php echo $eqrow['product_id']; ?>" 
					   data-bs-toggle="modal" data-bs-target="#confirmDeleteModal" 
					   title="Click for delete"> <span class="bi bi-trash"></span> Delete
					 </a>
					 
				   <?php  require_once 'modal/delete_modal_for_all_list.php'; ?>
				</td> 
			
				
				
			</tr>
		<?php
		}  
		?>

</tbody>
              </table>
            
            </div>
          </div>

        </div>
      </div>
    </section>

  </main>
  
  <?php  require_once 'footer1.php'; ?>