ok
Direktori : /home/importfo/public_html/chamundafurnitechindustry.in/admin/ |
Current File : //home/importfo/public_html/chamundafurnitechindustry.in/admin/sub-category.php |
<?php include("function.php") ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="A fully featured admin theme which can be used to build CRM, CMS, etc."> <meta name="author" content="Coderthemes"> <link rel="shortcut icon" href="images/favicon_1.png"> <title>Admin | Sub Category</title> <!-- Base Css Files --> <link href="css/bootstrap.min.css" rel="stylesheet" /> <!-- Font Icons --> <link href="assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> <link href="assets/ionicon/css/ionicons.min.css" rel="stylesheet" /> <link href="css/material-design-iconic-font.min.css" rel="stylesheet"> <!-- animate css --> <link href="css/animate.css" rel="stylesheet" /> <!-- Waves-effect --> <link href="css/waves-effect.css" rel="stylesheet"> <!-- Custom Files --> <link href="css/helper.css" rel="stylesheet" type="text/css" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script src="js/modernizr.min.js"></script> <link href="assets/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css" /> <link href="assets/select2/select2.css" rel="stylesheet" type="text/css" /> </head> <body class="fixed-left"> <!-- Begin page --> <div id="wrapper"> <!-- Top Bar Start --> <?php include("top.php"); ?> <!-- Top Bar End --> <!-- ========== Left Sidebar Start ========== --> <?php include("sidebar.php"); ?> <!-- Left Sidebar End --> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="content-page"> <!-- Start content --> <div class="content"> <div class="container"> <!-- Page-Title --> <div class="row"> <div class="col-sm-12"> <h4 class="pull-left page-title">Add Sub Categories </h4> <ol class="breadcrumb pull-right"> <li><a href="dashboard.php">Dashboard</a></li> <li class="active">Add Sub Categories</li> </ol> </div> </div> <?php if(isset($_GET['delete'])) { $delete=$_GET['delete']; } else { $delete=0; $slug=""; } $sql="delete from spare_parts where s_id='$delete'"; $res=mysqli_query($db,$sql); ?> <?php if(isset($_GET['slug'])) { $slug=$_GET['slug']; } else { $slug=0; } $sql="SELECT * FROM `spare_parts` where spare_slug='$slug'"; $res=mysqli_query($db,$sql); $row=mysqli_fetch_array($res); ?> <div class="row"> <div class="col-sm-12"> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title">Sub Categories</h3></div> <div class="panel-body"> <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"> <div class="form-group"> <label class="col-md-2 control-label">Select Categories</label> <div class="col-md-10"> <select class="form-control" name="spare_id"> <?php $select=machinparts(); ?> <?php foreach ($select as $key => $value) {?> <option value="<?php echo $key?>"> <?php echo $value?></option> <?php } ?> </select> </div> </div> <div class="form-group"> <label class="col-md-2 control-label">Sub Categories Title</label> <div class="col-md-10"> <input type="text" class="form-control" placeholder="Sub Categories Title" name="spare_name" value="<?php echo $row['spare_name']; ?>" > </div> </div> <div class="form-group"> <label class="col-md-2 control-label"></label> <div class="col-md-10"> <button type="submit" name="<?php if(isset($_GET['slug'])) { echo "Update"; } else { echo "Submit"; } ?>" class="btn btn-purple waves-effect waves-light"> <?php if(isset($_GET['slug'])) { echo "Update"; } else { echo "Submit"; } ?> </button> </div> </div> </form> <?php if(isset($_POST['Submit'])) { $spare_id=$_POST['spare_id']; $spare_name=$_POST['spare_name']; $spare_slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $spare_name))); $sql="INSERT INTO `spare_parts` (`s_id`,`spare_id`,`spare_name`,`spare_slug`) VALUES (NULL,'$spare_id','$spare_name','$spare_slug')"; $res=mysqli_query($db,$sql); if($res==1) { echo ("<script LANGUAGE='JavaScript'>window.alert('Succesfully added.!!');window.location.href='sub-category.php';</script>"); } else { echo ("<script LANGUAGE='JavaScript'>window.alert('Partners Not Added.!!');window.location.href='sub-category.php';</script>"); } } ?> <?php if(isset($_POST['Update'])) { $slug=$_GET['slug']; $spare_id=$_POST['spare_id']; $spare_name=$_POST['spare_name']; $spare_slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $spare_name))); $sql="update `spare_parts` set `spare_id`='$spare_id',`spare_name`='$spare_name',`spare_slug`='$spare_slug' where spare_slug='$slug'"; $res=mysqli_query($db,$sql); if($res==1) { echo ("<script LANGUAGE='JavaScript'>window.alert('Succesfully Updated'); window.location.href='sub-category.php';</script>"); } else { echo ("<script LANGUAGE='JavaScript'>window.alert('Not Updated Data.!'); window.location.href='sub-category.php';</script>"); } } ?> </div> <!-- panel-body --> </div> <!-- panel --> </div> <!-- col --> </div> <!-- End row --> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Sub Categories View</h3> </div> <div class="panel-body"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <table id="datatable" class="table table-striped table-bordered"> <thead> <tr> <th>ID</th> <th>Categories</th> <th>Sub Categories</th> <th>Setting</th> </tr> </thead> <tbody> <?php $sql="SELECT * from spare_parts s INNER JOIN spare_cat_main sc ON s.spare_id=sc.spare_id"; $res=mysqli_query($db,$sql); while($row=mysqli_fetch_array($res)) { ?> <tr> <td><?php echo $row['s_id']; ?></td> <td><?php echo $row['machine_name']; ?></td> <td><?php echo $row['spare_name']; ?></td> <td> <a href="sub-category.php?slug=<?php echo $row['spare_slug']; ?>"> <button class="btn btn-icon waves-effect waves-light btn-primary m-b-5"> <i class="fa fa-pencil"></i> </button> </a> <a href="sub-category.php?delete=<?php echo $row['s_id']; ?>"> <button class="btn btn-icon waves-effect waves-light btn-danger m-b-5" onclick="return confirm('Are you sure you want to delete this item?');"> <i class="fa fa-remove"></i> </button> </a> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- End Row --> </div> <!-- container --> </div> <!-- content --> <?php include("footer.php") ?> </div> <!-- ============================================================== --> <!-- End Right content here --> <!-- ============================================================== --> <!-- Right Sidebar --> <!-- /Right-bar --> </div> <!-- END wrapper --> <script> var resizefunc = []; </script> <!-- jQuery --> <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/waves.js"></script> <script src="js/wow.min.js"></script> <script src="js/jquery.nicescroll.js" type="text/javascript"></script> <script src="js/jquery.scrollTo.min.js"></script> <script src="assets/jquery-detectmobile/detect.js"></script> <script src="assets/fastclick/fastclick.js"></script> <script src="assets/jquery-slimscroll/jquery.slimscroll.js"></script> <script src="assets/jquery-blockui/jquery.blockUI.js"></script> <!-- CUSTOM JS --> <script src="js/jquery.app.js"></script> <script src="assets/datatables/jquery.dataTables.min.js"></script> <script src="assets/datatables/dataTables.bootstrap.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#datatable').dataTable(); } ); </script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery(".select2").select2({ width: '100%' }); }); </script> <script src="assets/select2/select2.min.js" type="text/javascript"></script> </body> </html>