📁
SKYSHELL MANAGER-
🛒
PHP v7.4.33
Create Folder
Create File
Current Path:
home
/
oshofree
/
public_html
/
chbluxuries.com
/
chb_data
/
Name
Size
Permissions
Actions
📁
..
-
0755
🗑️
🔒
📄
config.php
7.06 KB
0444
🗑️
⬇️
✏️
🔒
📄
error_log
5621.01 KB
0644
🗑️
⬇️
✏️
🔒
Editing: stockedit.php
<?php include "admin_header.php"; ?> <?php include "editstock.php"; ?> <!-- Begin Page Content --> <div class="container-fluid"> <style> .form-control{ font-size:13px; border-radius: 0; font-weight:500; color:black; } .col-form-label,.input-group-text{ font-size:13px; border-radius: 0; font-weight:500; color:black; } .zero{ background: none; color: none; font:none; border: none; padding: 0; outline:none; } .upload__inputfile{ display:none !important; } #iconm{ width: 80px; cursor: pointer; } .upload__box{ background: none; } .upkay{ background-color:black !important; border:none; outline:none; } .k-label{ color:#FF339A; font-size:14px; } </style> <!-- Page Heading --> <h1 class="h3 mb-4 text-gray-800">Update Stock</h1> <!-- Begin Add Stock Form --> <!-- Basic Layout --> <div class="col-xxl-12"> <div class="card mb-4"> <div class="card-body"> <form method="post" enctype="multipart/form-data"> <p style="color:blue;"><?php include "updatestock.php"; ?></p> <script type="text/javascript"> function initializeOrReinitializeTinyMCE() { tinymce.remove('#editor'); tinymce.init({ selector: '#editor', }); } $(document).on('click', '.delete', function(){ var image_id = $(this).attr("id"); var action = "delete"; var clickedBtn = $(this); // save reference to clicked button if(confirm("Are you sure you want to remove this image from database?")) { $.ajax({ url: "deleteimage.php", method: "POST", data: { image_id: image_id, action: action }, success: function(data) { clickedBtn.parent().parent().remove(); // use saved reference to delete button alert(data); fetch_data(); } }); } else { return false; } }); $(document).on('click', '.delete-variation', function(){ var image_id = $(this).attr("id"); var action = '<?php echo $group; ?>'; var clickedBtn = $(this); // save reference to clicked button if(confirm("Are you sure you want to remove this variation and any duplicates of it from this product?")) { $.ajax({ url: "deletevariation.php", method: "POST", data: { image_id: image_id, action: action }, success: function(data) { alert(data); clickedBtn.parent().remove(); } }); } else { return false; } }); </script> <div class="row mb-3"> <div class="col-sm-12"> <div class="upload__box"> <div class="upload__btn-box"> <label class="btn btn-sm btn-primary shadow-sm upkay"> <img id="iconm" src="camera.png"> <input type="file" name="product[]" multiple="" class="upload__inputfile" > </label> </div> <div class="upload__img-wrap"><?php //Get media $sqla = "SELECT * from stock_images WHERE id='$group' "; $sql2a = mysqli_query($con,$sqla); while($rowa = mysqli_fetch_array($sql2a)) { $media=$rowa['media']; $s=$rowa['s']; echo "<div class='upload__img-box'>"; echo' <div style="background-image: url(stocks/'.$media.');" data-file="'.$media.'" class="img-bg"> <div class="upload__img-close delete" id="'.$s.'"></div></div></div> '; } ?> </div></div> <script src="js/upload.js"></script> <link href="upload.css" rel="stylesheet"> </div> </div> <input type='text' name='orderid' value="<?php echo $id; ?>" hidden> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Brand Name</label> <div class="col-sm-10"> <input type="text" value="<?php echo"$stockname"; ?>" name="name" class="form-control" id="basic-default-name" placeholder="Dangote Sugar 330ml" required /> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Alternate Names</label> <div class="col-sm-10"> <input type="text" value="<?php echo"$stockaltname"; ?>" name="altname" style="text-transform:capitalize;" class="form-control" id="basic-default-name" placeholder="Dangote Sugar, Sugar, Dangote" /> </div> </div> <input type='text' name='incomplete' value='<?php echo $incomplete; ?>' required hidden> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Product Description</label> <div class="col-sm-10"> <textarea name="describe" style="text-transform:capitalize;" class="form-control" id="editor" placeholder="Dangote Sugar, is a bag of sugar" ><?php echo $details; ?></textarea> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" >Retail Price</label> <div class="col-sm-10"> <div class="input-group input-group-merge"> <span class="input-group-text">Naira (₦)</span> <input name="retail" type="number" class="form-control" placeholder="3000" value="<?php echo $retail; ?>" /> </div> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" >Discount Price</label> <div class="col-sm-10"> <div class="input-group input-group-merge"> <span class="input-group-text">Naira (₦)</span> <input name="discount" type="number" class="form-control" placeholder="3000" value="<?php echo"$price"; ?>" /> </div> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" >Wholesales Price</label> <div class="col-sm-10"> <div class="input-group input-group-merge"> <span class="input-group-text">Naira (₦)</span> <input name="whole" type="number" class="form-control" placeholder="3000" value="<?php echo "$whole"; ?>" /> </div> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Wholesales Q</label> <div class="col-sm-10"> <input type="number" value="<?php echo "$wholenum"; ?>" name="wquantity" class="form-control" id="basic-default-name" placeholder="5" /> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Item Category</label> <div class="col-sm-10" > <select name="category" id="productcategory" style="width:100%; font-size:13px !important; color:black !important; text-transform:capitalize;"> <option value="">-Select Product Category-</option> <?php // Get all sub categories $sql = "SELECT s, name, 'sub' as table_name FROM sub_category"; $sql2 = mysqli_query($con,$sql); while ($row = mysqli_fetch_array($sql2)) { $selected = ($row['name'] == $category_name && $row['s'] == $category_id && $row['table_name'] == $tablename) ? 'selected' : ''; echo "<option value='" . $row['s'] . "' data-table='" . $row['table_name'] . "' $selected>" . $row['name'] . "</option>"; } // Get all primary categories $sql = "SELECT s, name, 'primary' as table_name FROM pry_category"; $sql2 = mysqli_query($con,$sql); while ($row = mysqli_fetch_array($sql2)) { $selected = ($row['name'] == $category_name && $row['s'] == $category_id && $row['table_name'] == $tablename) ? 'selected' : ''; echo "<option value='" . $row['s'] . "' data-table='" . $row['table_name'] . "' $selected>" . $row['name'] . "</option>"; } // Get all baby categories $sql = "SELECT s, name, 'child' as table_name FROM baby_category"; $sql2 = mysqli_query($con,$sql); while ($row = mysqli_fetch_array($sql2)) { $selected = ($row['name'] == $category_name && $row['s'] == $category_id && $row['table_name'] == $tablename) ? 'selected' : ''; echo "<option value='" . $row['s'] . "' data-table='" . $row['table_name'] . "' $selected>" . $row['name'] . "</option>"; } ?> </select> </div></div> <input type="hidden" name="tablename" id="tablename" value=""> <script> // Get the select element var selectElement = document.getElementById("productcategory"); // Initialize Select2 $(selectElement).select2(); // Get the selected option on page load var selectedOption = selectElement.options[selectElement.selectedIndex]; // Get the data-table attribute value var selectedTableName = selectedOption.getAttribute("data-table"); // Set the value of the hidden input field document.getElementById("tablename").value = selectedTableName; // Listen for Select2 change event $(selectElement).on("select2:select", function(e) { // Get the selected option var selectedOption = e.params.data; // Get the data-table attribute value var tableName = selectedOption.element.getAttribute("data-table"); // Set the value of the hidden input field document.getElementById("tablename").value = tableName; }); </script> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Item Weight (Grams)</label> <div class="col-sm-10"> <input type="number" name="weg" value="<?php echo $weg; ?>" class="form-control" id="basic-default-name" placeholder="eg 40" /> <input type="hidden" name="group" value="<?php echo $group; ?>" id="groupid"/> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Item Total Quantity(All Stores)</label> <div class="col-sm-10"> <input type="number" value="<?php echo $totalquantity; ?>" class="form-control" id="basic-default-name" readonly/> </div> </div> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name">Store To Edit</label> <div class="col-sm-10"> <select class="form-control" name="store" id="selectedStore" required <?php echo $readonlystaff; ?>> <?php if ($stat == "superadmin" || $stat == "subadmin") { $sql = "select s, name from chb_stores"; $productstore=3; } else { $sql = "select s, name from chb_stores WHERE id='$staff_office'"; } $sql2 = mysqli_query($con, $sql); while ($row = mysqli_fetch_array($sql2)) { // Check if the current option is selected $selected = ($row['s'] == $productstore) ? 'selected' : ''; echo '<option value="' . $row['s'] . '" ' . $selected . '>' . $row['name'] . '</option>'; } ?> </select> </div></div> <input type="hidden" value="<?php echo $stat;?>" id="adminpermission" /> <div id="showQuantity"></div> <script> // Declare global variables var groupid; var admin; // Function to handle Ajax query function fetchData(selectedStore) { $.ajax({ url: 'showquantity.php', // Replace with the actual path to your Ajax script method: 'POST', data: { store: selectedStore, group: groupid, admin: admin }, success: function(response) { $('#showQuantity').html(response); }, error: function() { // Handle errors if necessary } }); } // Execute on page load if an option is already selected $(document).ready(function() { // Assign values to global variables groupid = $('#groupid').val(); admin = $('#adminpermission').val(); var selectedStore = $('#selectedStore').val(); if (selectedStore) { fetchData(selectedStore); } }); // Execute on select change $('#selectedStore').on('change', function() { var selectedStore = $(this).val(); groupid = $('#groupid').val(); // Update the value of groupid admin = $('#adminpermission').val(); // Update the value of admin $('#showQuantity').html(''); // Clear previous results if (selectedStore) { fetchData(selectedStore); } }); </script> <br><br> <div class="row mb-3"> <label class="col-sm-2 col-form-label" for="basic-default-name"></label> <div class="col-sm-10"> <button type="submit" name="submitupdate" value="submit" class="btn btn-primary w-100">Update Stock</button></div> </div> </form> </div> </div> </div> <div class='modal fade border-0' id='myTransfer' tabindex='-1'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-body' style='color:black; font-size:20px;'> <p style='text-align:center; font-weight:600;'>Transfer stocks to another store?</p> <p style='text-align:center; font-size:13px;'><i>Cancel or Click Transfer to Continue</i></p> <div class='modal-footer border-0'> <form action='transfer.php' method='post'> <input type='text' name='orderid' value='<?php echo $itemid; ?>' required hidden> <button type='submit' style='font-size:14px;' class='btn btn-primary' name='submit' value='Transfer Stock'>Transfer Stock</button></form> <a href='<?php echo $incomplete; ?>' style='font-size:14px;' class='btn btn-secondary'>No,Don't Transfer</a> </div> </div> </div> </div> </div> </div><!-- /.container-fluid --> </div> <?php include "footer.php"; ?>
💾 Save Changes