<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Diabease</title>
<!-- Favicon -->
<link rel="shortcut icon" href="../assets/images/diabease/DiabEaseLogo.png" />
<!-- Plugin styles -->
<link rel="stylesheet" href="vendors/bundle.css" type="text/css">
<!-- Slick -->
<link rel="stylesheet" href="vendors/slick/slick.css" type="text/css">
<link rel="stylesheet" href="vendors/slick/slick-theme.css" type="text/css">
<!-- Daterangepicker -->
<link rel="stylesheet" href="vendors/datepicker/daterangepicker.css" type="text/css">
<!-- DataTable -->
<link rel="stylesheet" href="vendors/dataTable/datatables.min.css" type="text/css">
<!-- App styles -->
<link rel="stylesheet" href="assets/css/app.min.css" type="text/css">
</head>
<body class="">
<?php include('header.php');
if(isset($_GET['type']) && $_GET['type']!=''){
$type=get_safe_value($con,$_GET['type']);
if($type=='status'){
$operation=get_safe_value($con,$_GET['operation']);
$id=get_safe_value($con,$_GET['id']);
if($operation=='active'){
$status='1';
}else{
$status='0';
}
$update_status_sql="update category set status='$status' where id='$id'";
mysqli_query($con,$update_status_sql);
}
if($type=='delete'){
$id=get_safe_value($con,$_GET['id']);
$delete_sql="delete from category where id='$id' ";
mysqli_query($con,$delete_sql);
}
}
$sql="SELECT * FROM `blog`";
$res=mysqli_query($con,$sql);
?>
<div class="content-body">
<div class="content">
<div class="page-header justify-content-between">
<nav aria-label="breadcrumb" class="d-flex align-items-start">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.php">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page"><a href="category.php">Blogs List</a>
</li>
</ol>
</nav>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<h6 class="card-title">Blogs List</h6>
<div class="table-responsive" tabindex="1" style="overflow: hidden; outline: none;">
<div id="orders_wrapper" class="dataTables_wrapper dt-bootstrap4 no-footer">
<div class="row">
<div class="col-sm-12">
<table id="orders" class="table table-lg dataTable no-footer" role="grid"
aria-describedby="orders_info">
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="orders"
rowspan="1" colspan="1" aria-sort="ascending"
aria-label="ID: activate to sort column descending"
style="width: 27.625px;">ID</th>
<th class="sorting" tabindex="0" aria-controls="orders"
rowspan="1" colspan="1" style="width: 303.406px;">blog
Name</th>
<th class="sorting_disabled" rowspan="1" colspan="1"
aria-label="Action" style="width: 45.2031px;">Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while($row=mysqli_fetch_assoc($res)){?>
<tr role="row" class="odd">
<td class="sorting_1">
<a href="#"><?php echo $i?></a>
</td>
<td> <span><?php echo $row['name']?></span> </td>
<td>
<?php
echo "<a href='add-blog.php?id=".$row['id']."' class='m-l-r-10 text-secondary' data-toggle='tooltip' data-original-title='Edit'><i class='ti-pencil'></i></a>";
echo "<a href='#' onclick=\"remove_item('".$row['id']."'); return false;\" class='text-secondary' data-toggle='tooltip' data-original-title='Delete'><i class='ti-trash'></i></a>";
?>
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include('footer.php')?>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script>
function remove_item(id) {
var result = confirm('Are you sure?');
if (result == true) {
jQuery.ajax({
url: 'remove-item.php',
data: 'id=' + id,
type: 'post',
dataType: 'json',
success: function(response) {
if (response.status == 1) {
// Item was successfully deleted
alert(response.message);
location.reload();
} else {
// Deletion failed or user is not logged in as admin
alert(response.message);
}
},
});
}
}
$(document).ready(function() {
$('#orders').DataTable({
paging: true // Enable pagination
});
});
</script>
<!-- Plugin scripts -->
<script src="vendors/bundle.js"></script>
<!-- Apex chart -->
<script src="https://apexcharts.com/samples/assets/irregular-data-series.js"></script>
<script src="vendors/charts/apex/apexcharts.min.js"></script>
<!-- Daterangepicker -->
<script src="vendors/datepicker/daterangepicker.js"></script>
<!-- DataTable -->
<script src="vendors/dataTable/datatables.min.js"></script>
<!-- Dashboard scripts -->
<script src="assets/js/examples/dashboard.js"></script>
<!-- Vamp -->
<script src="vendors/vmap/jquery.vmap.min.js"></script>
<script src="vendors/vmap/maps/jquery.vmap.usa.js"></script>
<script src="assets/js/examples/vmap.js"></script>
<script src="assets/js/examples/pages/ecommerce-dashboard.js"></script>
<!-- App scripts -->
<script src="assets/js/app.min.js"></script>
</body>
</html>