File: /var/www/html/barcode/admin/manage-barcode.php
<?php session_start();
include_once('../includes/config.php');
if (strlen($_SESSION['adminid'] == 0)) {
header('location:logout.php');
} else {
// for deleting barcode
if (isset($_GET['id'])) {
$barcode_id = $_GET['id'];
$msg = mysqli_query($con, "delete from barcodes where id='$barcode_id'");
if ($msg) {
echo "<script>alert('Data deleted');</script>";
}
}
?>
<!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, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Manage Barcode | Barcode Management System</title>
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" />
<link href="../css/styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js" crossorigin="anonymous"></script>
</head>
<body class="sb-nav-fixed">
<?php include_once('includes/navbar.php'); ?>
<div id="layoutSidenav">
<?php include_once('includes/sidebar.php'); ?>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h3 class="mt-4">Manage Product Barcodes</h3>
<div class="row">
<div class="col-md-10">
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
<li class="breadcrumb-item active">Manage Product Barcodes</li>
</ol>
</div>
<div class="col-md-2">
<a href="upload-product.php" class="btn btn-sm btn-dark">Upload Product</a>
</div>
</div>
<div class="card mb-4">
<div class="card-header">
<i class="fas fa-table me-1"></i>
Barcodes Details
</div>
<div class="card-body">
<table id="datatablesSimple">
<thead>
<tr>
<th>Sno.</th>
<th>Name</th>
<th>Code</th>
<th>Thickness</th>
<th>Size</th>
<th>Batch No.</th>
<th>Slab No.</th>
<th>Book Matching</th>
<th>Grade</th>
<!-- <th>Barcode</th> -->
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $ret = mysqli_query($con, "select * from barcodes");
$cnt = 1;
while ($row = mysqli_fetch_array($ret)) {
$barcode_left = $row['product_name'].'/'.$row['product_code'].'/'. $row['thickness'].'/'.$row['size'].'/'.$row['batch_no'].'/'.$row['slab_no'].'/'.$row['book_matching'].'/'.$row['grade'];
?>
<tr>
<td><?php echo $cnt; ?></td>
<td><?php echo $row['product_name']; ?></td>
<td><?php echo $row['product_code']; ?></td>
<td><?php echo $row['thickness']; ?></td>
<td><?php echo $row['size']; ?></td>
<td><?php echo $row['batch_no']; ?></td>
<td><?php echo $row['slab_no']; ?></td>
<td><?php echo $row['book_matching']; ?></td>
<td><?php echo $row['grade']; ?></td>
<!-- <td><?php //echo $row['barcode']; ?></td> -->
<td>
<a href="edit-product.php?pid=<?php echo $row['id']; ?>"><i class="fas fa-edit" title="Edit"></i></a>
<a href="manage-barcode.php?id=<?php echo $row['id']; ?>" onClick="return confirm('Do you really want to delete');"><i class="fa fa-trash" aria-hidden="true" title="Delete"></i></a>
<a href="barcode/generate-barcode.php?p_code=<?php echo $barcode_left; ?>" target="blank"><i class="fas fa-barcode" title="Barcode"></i></a>
</td>
</tr>
<?php $cnt = $cnt + 1;
} ?>
</tbody>
</table>
</div>
</div>
</div>
</main>
<?php include('../includes/footer.php'); ?>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="../js/scripts.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" crossorigin="anonymous"></script>
<script src="../js/datatables-simple-demo.js"></script>
</body>
</html>
<?php } ?>