HOME


Mini Shell 1.0
DIR: /home/islapiiu/sites/pramudi/control-panel/
Upload File :
Current File : /home/islapiiu/sites/pramudi/control-panel/create-product.php
<?php
//
include_once(dirname(__FILE__) . '/../class/include.php');
include_once(dirname(__FILE__) . '/auth.php');

$id = '';
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
//$PRODUCT = new Product($id);
?> 

<!DOCTYPE html>
<html> 
    <head>
        <meta charset="UTF-8">
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <title>Products</title>
        <!-- Favicon-->
        <link rel="icon" type="image/x-icon" href="../images/3d-fav1.png" />
        <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
        <link href="plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="plugins/node-waves/waves.css" rel="stylesheet" />
        <link href="plugins/animate-css/animate.css" rel="stylesheet" />
        <link href="plugins/sweetalert/sweetalert.css" rel="stylesheet" />
        <link href="css/style.css" rel="stylesheet">
        <link href="css/themes/all-themes.css" rel="stylesheet" />
        <link href="css/jm.spinner.css" rel="stylesheet" type="text/css"/>
    </head>

    <body class="theme-red">
        <div class="box"></div>
        <?php
        include './navigation-and-header.php';
        ?>

        <section class="content">
            <div class="container-fluid">  
                <?php
                $vali = new Validator();

                $vali->show_message();
                ?>
                <!-- Vertical Layout -->
                <div class="row clearfix">
                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <div class="card">
                            <div class="header">
                                <h2>Create Product</h2>
                                <ul class="header-dropdown">
                                    <li class="">
                                        <a href="manage-product-categories.php">
                                            <i class="material-icons">list</i> 
                                        </a>
                                    </li>
                                </ul>
                            </div>
                            <div class="body">
                                <form class="form-horizontal"  method="post"  id="form-data" enctype="multipart/form-data"> 
                                    <div class="col-md-12">
                                        <div class="form-group form-float">
                                            <div class="form-line">
                                                <select class="form-control" name="product_category" id="tour_type" disabled="true">
                                                    <option value=""> --Please Select the Product Category -- </option>

                                                    <?php
                                                    $PRODUCT_CATEGORY = new ProductCategory(NULL);
                                                    foreach ($PRODUCT_CATEGORY->all() as $key => $product_category) {
                                                        if ($product_category['id'] == $id) {
                                                            ?>
                                                            <option value=" <?php echo $product_category['id'] ?>" selected="">  <?php echo $product_category['name'] ?> </option> 
                                                            <?php
                                                        } else {
                                                            ?>
                                                            <option value=" <?php echo $product_category['id'] ?>"  >  <?php echo $product_category['name'] ?> </option> 

                                                            <?php
                                                        }
                                                    }
                                                    ?>
                                                </select>
                                            </div>
                                        </div>
                                    </div>                                                                                                                                                                                                                                                          
                                    <div class="col-md-12">
                                        <div class="form-group form-float">
                                            <div class="form-line">
                                                <label class="form-label">Title</label>
                                                <input type="text" id="name" class="form-control"  autocomplete="off" name="name" required="true">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-12">                                       
                                        <div class="form-group form-float">
                                            <div class="form-line">
                                                <input type="file" id="image" class="form-control" name="image"  required="true">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                        <label for="description">Description</label>
                                        <div class="form-line">
                                            <textarea id="description" name="description" class="form-control" rows="5"></textarea> 
                                        </div>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="form-group form-float">
                                            <div class="form-line">
                                                <label class="form-label">Price (US $)</label>
                                                <input type="number" id="price" class="form-control"  autocomplete="off" name="price" required="true">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="form-group form-float">
                                            <div class="form-line">
                                                <label class="form-label">Discount (%)</label>
                                                <input type="number" id="discount" class="form-control"  autocomplete="off" name="discount" required="true">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-12"> 
                                        <input type="hidden" name="create"value="create"/>
                                        <input type="hidden" name="category" id="category" value="<?= $id; ?>"/>
                                        <input type="submit" id="create" class="btn btn-primary m-t-15 waves-effect" value="create"/>
                                    </div>
                                </form>
                                <div class="row clearfix">  </div>
                                <hr/>
                            </div>
                        </div>
                        <div class="card">
                            <div class="header">
                                <h2>
                                    Manage Products
                                </h2>
                            </div>
                            <div class="body">
                                <div class="row clearfix">
                                    <?php
                                    $PRODUCT = Product::getProductsByCategory($id);
                                    if (count($PRODUCT) > 0) {
                                        foreach ($PRODUCT as $key => $product) {
                                            ?>
                                            <div class="col-md-3"  id="div<?php echo $product['id']; ?>">
                                                <div class="photo-img-container">
                                                    <img src="../upload/product/<?php echo $product['image_name']; ?>" class="img-responsive ">
                                                </div>
                                                <div class="img-caption">
                                                    <p class="maxlinetitle"><?php echo $product['name']; ?></p>
                                                    <div class="d">  
                                                        <a href="edit-product.php?id=<?php echo $product['id']; ?>"> <button class="glyphicon glyphicon-pencil edit-btn"></button></a> | 
                                                        <a href="#" class="delete-product" data-id="<?php echo $product['id']; ?>"> <button class="glyphicon glyphicon-trash delete-btn"></button></a> |
                                                                <a href="view-product-photos.php?id=<?php echo $product['id']; ?>">  <button class="glyphicon glyphicon-picture arrange-btn"></button></a> | 
                                                        <a href="arrange-products.php">  <button class="glyphicon glyphicon-random arrange-btn"></button></a>
                                                    </div>
                                                </div>
                                            </div>
                                            <?php
                                        }
                                    } else {
                                        ?> 
                                        <b style="padding-left: 15px;">No Products in the database.</b> 
                                    <?php } ?> 
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- #END# Vertical Layout -->
            </div>
        </section>

        <!-- Jquery Core Js -->
        <script src="plugins/jquery/jquery.min.js"></script>
        <script src="plugins/bootstrap/js/bootstrap.js"></script> 
        <script src="plugins/jquery-slimscroll/jquery.slimscroll.js"></script>
        <script src="plugins/node-waves/waves.js"></script>
        <script src="js/admin.js"></script>
        <script src="js/demo.js"></script>
        <script src="js/add-new-ad.js" type="text/javascript"></script>

        <script src="plugins/sweetalert/sweetalert.min.js"></script>
        <script src="tinymce/js/tinymce/tinymce.min.js"></script>
        <script>
            tinymce.init({
                selector: "#description",
                // ===========================================
                // INCLUDE THE PLUGIN
                // ===========================================

                plugins: [
                    "advlist autolink lists link image charmap print preview anchor",
                    "searchreplace visualblocks code fullscreen",
                    "insertdatetime media table contextmenu paste"
                ],
                // ===========================================
                // PUT PLUGIN'S BUTTON on the toolbar
                // ===========================================

                toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages",
                // ===========================================
                // SET RELATIVE_URLS to FALSE (This is required for images to display properly)
                // ===========================================

                relative_urls: false

            });


        </script>
        <script src="js/jm.spinner.js" type="text/javascript"></script>
        <script src="js/ajax/product.js" type="text/javascript"></script>
        <script src="delete/js/product.js" type="text/javascript"></script>
    </body>

</html>