%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_93b53270/admin/manage_category/ |
Upload File : |
<?php
include("../function.php");
if($_SESSION['admin_id']==""){
header('location:../login.php');
}
$login_tbl=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM admin WHERE admin_id='".$_SESSION['admin_id']."'"));
include('../include/sidebar.php');
?>
<!-- [ Main Content ] start -->
<div class="pcoded-main-container">
<div class="pcoded-content">
<!-- [ breadcrumb ] start -->
<div class="page-header">
<div class="page-block">
<div class="row align-items-center">
<div class="col-md-12">
<div class="page-header-title">
<div class="card-header d-flex justify-content-between">
<button class="btn btn-light text-dark fw-bold btn-sm btn-round has-ripple"><i class="feather icon-check-square"></i> Manage Category </button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- [ breadcrumb ] end -->
<!-- [ Main Content ] start -->
<div class="row">
<!-- [ col-md-12 ] start -->
<form method="post" action="">
<div class="col-md-12">
<div class="card">
<div class="card-header d-flex justify-content-between">
<h5>Manage Category</h5>
<div>
<a href="add_edit.php?page=cate" class="btn btn-info btn-sm btn-round has-ripple text-white"><i class="feather icon-plus"></i>Add</a>
<input class="btn btn-danger btn-sm btn-round has-ripple" type="submit" value="Delete" name='but_delete' onclick="return confirm('Are you sure to delete the record?');">
<input class="btn btn-success btn-sm btn-round has-ripple" type="submit" value="Active" name='but_active'>
<input class="btn btn-secondary btn-sm btn-round has-ripple" type="submit" value="Deactive" name='but_deactive'>
</div>
</div>
<div class="card-body">
<?php if(isset($_SESSION['message'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['message'].' <i class="feather icon-thumbs-up text-success"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['message']);
?>
<?php if(isset($_SESSION['error'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['error'].' <i class="feather icon-thumbs-up text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['error']);
?>
<?php if(isset($_SESSION['delete'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['delete'].' <i class="feather icon-trash-2 text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['delete']);
?>
<div class="table-responsive">
<table id="report-table" class="table table-bordered table-striped mb-0">
<thead>
<tr>
<th><input type="checkbox" id="some1" data-check-pattern="[name^='delete']" />
</th>
<th>Sno</th>
<th>Category</th>
<th>Image1</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$query=mysqli_query($conn,"SELECT * FROM `product_product_sevice_tbl` ORDER BY sequence ASC");
$n=1;
while($fetch_row=mysqli_fetch_array($query)){
?>
<tr data-row-id="<?=$fetch_row['id']; ?>">
<td><input type='checkbox' name='delete[]' value='<?=$fetch_row['id'];?>'></td>
<td class="draggable-handle"><?=$n; $n++;?></td>
<td class="draggable-handle"><?=$fetch_row['title']?></td>
<td class="draggable-handle">
<img src="<?=$base_url?>images/Upload/service/<?=$fetch_row['image1']?>" class="pb-2" style="width:100px;">
</td>
<td>
<?php
if(($fetch_row['status']=='1')){
echo'<a href="show.php?page=cate&&status_id='.$fetch_row['id'].'" class="btn btn-success btn-sm"><i class="feather icon-eye"></i></a>';
}
else{
echo'<a href="show.php?page=cate&&status_id='.$fetch_row['id'].'" class="btn btn-danger btn-sm"><i class="feather icon-eye-off"></i></a>';
}
?>
<a href="add_edit.php?page=cate&&id=<?=$fetch_row['id']?>" class="btn btn-info btn-sm"><i class="feather icon-edit"></i></a>
<a href="show.php?page=cate&&delete_id=<?=$fetch_row['id']?>" onclick="return confirm('Are you sure to delete the record?');" class="btn btn-danger btn-sm"><i class="feather icon-trash-2"></i></a>
</td>
</tr>
<?php } ;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
<!-- col-md-12 end -->
</div>
<!-- [ Main Content ] end -->
</div>
</div>
<?php include('../include/footer.php'); ?>
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// Make the table rows sortable
$("#report-table tbody").sortable({
handle: '.draggable-handle',
/*handle: 'td:nth-child(1,3)',*/ // Make the second column the handle for dragging
update: function (event, ui) {
// Update the sequence in the database using AJAX
var newOrder = $(this).sortable('toArray', { attribute: 'data-row-id' }).toString();
$.ajax({
type: 'POST',
url: 'update_sequence.php',
data: { newOrder: newOrder },
success: function (response) {
// Handle the response from the server if needed
console.log(response);
}
});
}
});
// Prevent text selection while dragging
$("#report-table tbody").disableSelection();
});
</script>
<?php
if(!empty($_GET['status_id'])){
$id=$_GET['status_id'];
$stsQry=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `product_product_sevice_tbl` WHERE id ='$id'"));
if($stsQry['status']==0){
$updtQry=mysqli_query($conn,"UPDATE `product_product_sevice_tbl` SET `status`='1' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=cate';</script>";
$_SESSION['message']="Record Activated Successfully";
}
}
elseif($stsQry['status']==1){
$updtQry=mysqli_query($conn,"UPDATE `product_product_sevice_tbl` SET `status`='0' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=cate';</script>";
$_SESSION['error']="Record Inactivated Successfully";
}
}
}
?>
<?php
if(!empty($_GET['delete_id'])){
$id=$_GET['delete_id'];
$query=mysqli_query($conn,"SELECT * FROM product_product_sevice_tbl WHERE id=".$_GET['delete_id']);
while($row=mysqli_fetch_array($query))
{
$image_name=$row['image1'];
unlink("../../images/Upload/service/".$row['image1']);
}
$dtQuery=mysqli_query($conn,"DELETE FROM `product_product_sevice_tbl` WHERE id=".$_GET['delete_id']);
if($dtQuery){
echo "<script>window.location='show.php?page=cate';</script>";
$_SESSION['delete']="Record Deleted Successfully";
}
}
?>
<?php
if(isset($_POST['but_delete'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$query=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM product_product_sevice_tbl WHERE id=".$deleteid));
unlink("../../images/Upload/service/".$query['image1']);
$deleteUser = "DELETE from product_product_sevice_tbl WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
}
echo "<script>window.location='show.php?page=cate';</script>";
$_SESSION['delete']="All Record Deleted Successfully";
}
}
?>
<?php
if(isset($_POST['but_active'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "UPDATE `product_product_sevice_tbl` SET `status`='1' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
echo "<script>window.location='show.php?page=cate';</script>";
$_SESSION['message']="All Record Activated Successfully";
}
}
}
?>
<?php
if(isset($_POST['but_deactive'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "UPDATE `product_product_sevice_tbl` SET `status`='0' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
}
echo "<script>window.location='show.php?page=cate';</script>";
$_SESSION['error']="All Record Inactivated Successfully";
}
}
?>