<?php
$msg='';


$conn=new MySQLi("localhost","karan_live","Sailor@123!","karan_live");  //Live Rishta DB

// Fetch records
$sql = "SELECT * FROM source";
$result = mysqli_query($conn, $sql);
?>


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Manage Source- Rishta Depot </title>
  
		
<?php include('./include/meta.php'); ?>

</head>
	
<?php include('./include/header.php'); ?>
  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
	  <div class="container-full">
		<!-- Content Header (Page header) -->
		<div class="content-header">
			<div class="d-flex align-items-center">
				<div class="me-auto">
					<h4 class="page-title">Source</h4>
							<center><p class="errormessage" id="errormessage"><?php echo $msg ?></p></center>
					<div class="d-inline-block align-items-center">
						<nav>
							<ol class="breadcrumb">
								<li class="breadcrumb-item"><a href="#"><i class="mdi mdi-home-outline"></i></a></li>
								<li class="breadcrumb-item" aria-current="page">Manage Source</li>
								<li class="breadcrumb-item active" aria-current="page">Source</li><br>
								<li style="padding-left:10px;">	<a href="add-source.php" class="waves-effect waves-light nav-link bg-primary btn-primary w-auto fs-14" title="Full Screen">
					Add Source
			    </a></li>
							</ol>
						</nav>
					</div>
				</div>
				
			</div>
		</div>

		<!-- Main content -->
		<section class="content">
		  <div class="row">
			<div class="col-12">

			 <div class="box">
				<div class="box-header with-border">
				  <h3 class="box-title">Manage Souce</h3>
				</div>
			
				<!-- /.box-header -->
				<div class="box-body">
					<div class="table-responsive">
						<?php
										if(mysqli_num_rows($result)>0)
										{
											?>
					  <table id="example1" class="table table-bordered table-striped">
						<thead>
							<tr>
								<th>Sr.No</th>
							
								<th>Status</th>
								<th>Edit/Delete</th>
							</tr>
						</thead>
						<tbody>
						         <?php
													$i=0;
												while ($row = mysqli_fetch_assoc($result))
													{
														$i++;
														?>
															<tr class="text-center">
																<td><?php echo $i; ?></td>
																<td><?php echo $row['name']; ?></td>
														
																<td>
																    
															                        <a href="edit-source.php?id=<?php echo $row['id']; ?>">Edit</a>
                     /    <a href="delete-source.php?id=<?php echo $row['id']; ?>" onclick="return confirm('Are you sure?')">Delete</a>
																
																</td>
															</tr>
														<?php
													}
													?>
						</tbody>
					  </table>
					  	<?php
										}
									?>
					</div>
				</div>
				<!-- /.box-body -->
			  </div>
			  <!-- /.box -->


			  <!-- /.box -->          
			</div>
			<!-- /.col -->
		  </div>
		  <!-- /.row -->
		</section>
		<!-- /.content -->
	  
	  </div>
  </div>
  <!-- /.content-wrapper -->
  	<script>
		function getstatus(v)
		{
			$('#loading').css('display','');
			$.ajax({
					url: 'ajaxgetstatus.php', 
					type: 'post',
					data:  {"usertype":v},
					datatype: 'html',
					success: function(rsp)
					{
						$('#ajaxcoursedata').html(rsp);
						$('#loading').css('display','none');
					}
				});
		}
	</script>
	
<?php include('./include/footer.php'); ?>
