<?php include "header.php"; include "sidebar.php"; ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Manage Category <a href="add-category.php" class="btn btn-primary pull-right" style="margin-top:-5px;"><i class="fa fa-plus"></i>&nbsp;Add Category</a> <!--<small>...</small>--> </h1> </section> <section class="content"> <div class="row"> <div class="col-sm-12"> <div class="box"> <div class="box-body"> <?php if(isset($_SESSION['msg']) && $_SESSION['msg']=='data_uploaded') { ?> <div class="row"> <div class="col-sm-6"> <div class="alert alert-success alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="fa fa-close"></i></button> Product Added successfully!!. </div> </div> </div> <?php $_SESSION['msg'] = ''; } ?> <?php if(isset($_SESSION['msg']) && $_SESSION['msg']=='data_updated') { ?> <div class="row"> <div class="col-sm-6"> <div class="alert alert-success alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="fa fa-close"></i></button> Product Updated successfully!!. </div> </div> </div> <?php $_SESSION['msg'] = ''; } ?> <?php if(isset($_SESSION['msg']) && $_SESSION['msg']=='status_changed') { ?> <div class="row"> <div class="col-sm-6"> <div class="alert alert-success alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="fa fa-close"></i></button> Status changed successfully!!. </div> </div> </div> <?php $_SESSION['msg'] = ''; } ?> <?php if(isset($_SESSION['msg']) && $_SESSION['msg']=='delete_data') { ?> <div class="row"> <div class="col-sm-6"> <div class="alert alert-success alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> Product Deleted !!. </div> </div> </div> <?php $_SESSION['msg'] = ''; } ?> <table id="employee-role-table" class="table table-bordered table-striped"> <thead> <tr> <th># Id</th> <!--<th>Category</th>--> <!-- <th>Brand</th> --> <th>Category Name</th> <!--<th>Product Code</th>--> <th>Image</th> <!--<th>Min Price</th>--> <!--<th>View Images</th>--> <th>Edit</th> <th>Status</th> <th>Delete</th> </tr> </thead> <tbody> <?php //$fetch_product=mysqli_query($con,"SELECT `pr`.*,`cat`.`category_name`,`bnd`.`brand` FROM `spc_product` AS `pr` LEFT JOIN `spc_category` AS `cat` ON `pr`.`category_id`=`cat`.`category_id` LEFT JOIN `spc_brand` AS `bnd` ON `pr`.`brand_id`=`bnd`.`brand_id` ORDER BY `pr`.`category_id` DESC") or die(mysqli_error($con)); $fetch_product=mysqli_query($con,"SELECT * FROM `spc_category` ") or die(mysqli_error($con)); $i=1; if(mysqli_num_rows($fetch_product)>0) { while($data = mysqli_fetch_array($fetch_product)) { //print_r($data); exit; ?> <tr> <td><?php echo $i;?></td> <!--<td><?php //echo $data['category_name'];?></td>--> <!-- <td><?php //echo $data['brand'];?></td> --> <td><?php echo $data['category_name'];?></td> <!--<td><?php //echo $data['product_code'];?></td>--> <td><?php $productImg = "Category Images"; $imgfileSource = ".." . DIRECTORY_SEPARATOR . $productImg . DIRECTORY_SEPARATOR . $data['image']; if(file_exists($imgfileSource)){ ?> <img src="<?php echo $imgfileSource; ?>" style="width:150px; height:150px;" /><?php } ?> </td> <!-- <td>Rs.<?php //echo productminprice($con,$data['category_id']); ?></td> --> <!--<td>Rs. <?php //echo $data['original_price'];?></td>--> <!-- <td> <a href="product-images.php?id=<?php //echo base64_encode($data['category_id']); ?>" class="btn btn-primary" style="margin-right:2px;margin-bottom:6px;" title="View Images"><i class="fa fa-image"> Images</i></a> </td>--> <td><a href="edit-category.php?action=edit&id=<?php echo base64_encode($data['category_id']);?>" class="btn btn-default" style="margin-right:2px;margin-bottom:6px;" title="Edit"><i class="fa fa-pencil"> Edit</i></a> <td> <?php if($data['status']=="1"){?> <a title="Click here to Disable Record" class="show-pointer"><span class="label label-success statusButton" id="<?php echo base64_encode($data['category_id']);?>">Active</span></a> <?php } if($data['status']=="0"){?> <a title="Click here to Active This Record" class="show-pointer"><span class="label label-warning statusButton" id="<?php echo base64_encode($data['category_id']);?>">Deactive</span></a> <?php }?> </td> <td><a title="Click here to Delete This Record" class="show-pointer"><span class="label label-danger deleteButton" id="<?php echo base64_encode($data['category_id']);?>">Delete</span></a></td> </tr> <?php $i++; } } ?> </tbody> </table> </div><!-- /.box-body --> </div><!-- /.box --> </div> </div> </section> </div> <script> $(".deleteButton").click(function() { var dataid = $(this).attr('id'); if(confirm("Do you really want to delete this record?")) { window.location = "category-process.php?action=delete&id="+dataid; } }); $(".statusButton").click(function() { var dataid = $(this).attr('id'); if(confirm("Do you really want to change the status of this record?")) { window.location = "category-process.php?action=status&id="+dataid; } }); $(function () { $('#employee-role-table').DataTable({ "paging": true, "lengthChange": true, "searching": true, "ordering": true, "info": true, "autoWidth": false }); }); </script> <?php include "footer.php"; ?>