/
var
/
www
/
html
/
stengineers
/
admin
/
Upload FileeE
HOME
<?php header('Access-Control-Allow-Origin: *'); require_once 'dbconnection.php'; error_reporting(0); $pmenu_active = "active"; include 'header.php'; ?> <style> .tab__container { background: #fafafa; width: 75vw; margin: auto; border-radius: 5px; padding: 30px 30px 120px; max-width: 1200px; } .tab__title { margin: 25px 0 0; } .tab__title .tab__button:first-of-type { margin: 0; } .tab__title .tab__button { padding: 15px; color: #545454; border: 1px solid #e5e5e5; background: #f5f5f5; outline: none; margin: 0 -5px; cursor: pointer; width: 25%; } .tab__title .tab__button img { height: 25px; display: block; margin: 0px auto 5px; -webkit-filter: grayscale(100%); filter: grayscale(100%); transition: filter 0.3s ease; } .tab__title .tab_button-active { border-bottom: none; background: #008D42; color: #fff; } .tab__title .tab_button-active img { filter: none; } .tab__inside { display:block; visibility: hidden; opacity: 0; height: 0; transform: translateY(10px); transition: transform 0.3s ease-in; } .tab__inside-active { visibility: visible; opacity: 1; height: 100%; transform: translateY(0); transition: transform 0.3s ease-out 0.1s, opacity 0.3s ease-out 0.1s; } .custom-dropdown { position: relative; display: inline-block; } .custom-option { display: flex; align-items: center; padding: 5px; cursor: pointer; } .brand-logo { max-width: 30px; max-height: 30px; margin-right: 10px; } /* Hidden default select box */ select { display: none; } </style> <!-- Include jQuery --> <script src="js/products.js"></script> <!-- Include Select2 JS --> <div class="tab__title"> <button class="tab__button tab_button-active">Add New Product</button> <!-- <button class="tab__button" onclick="openTab('two')">Specifications</button> --> </div> <div id="one" class=""> <div class="card o-hidden border-0 "> <div class="card-body p-0"> <!-- Nested Row within Card Body --> <div class="row"> <!-- <div class="col-lg-5 d-none d-lg-block bg-register-image"></div> --> <div class="col-lg-12"> <div class="ml-4 mr-4"> <form class="user"> <div class="form-group row"> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Product Name</label> <input type="text" class="form-control form-control-solid" id="product_name" name="product_name" placeholder="Product Name"> <div class="audit_error" style="color:red;" id="productErr"></div> </div> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Product Modal</label> <input type="text" class="form-control form-control-solid" id="product_modal" name="product_modal" placeholder="Product Modal"> <div class="audit_error" style="color:red;" id="product_modalErr"></div> </div> <div class="col-sm-4"> <?php $resultCategories = $con->query("SELECT * FROM category WHERE category_type='Parent' AND status='active'"); if (!$resultCategories) { // Query failed, handle the error die('Error in query: ' . $con->error); } ?> <label>Product Category</label> <select class="form-control form-control-solid" name="category" id="category" onchange="getsubcateg()"> <option value="">Select Category</option> <?php while ($row = $resultCategories->fetch_assoc()) { $categoryId = $row['id']; $categoryName = $row['category_name']; echo "<option value='$categoryId'>$categoryName</option>"; } ?> </select> <!-- <label>Product Category</label> <select class="form-control form-control-solid" name="category" id="category" > <option value="">Select Category</option> <option value="active">Active</option> <option value="inactive">Inactive</option> </select> --> <div class="audit_error" style="color:red;" id="categoryErr"></div> </div> </div> <div class="form-group row"> <div class="col-sm-8"> <label>Brouchure</label> <input type="hidden" id="pdf_path" name="pdf_path" /> <form method="post" action="" enctype="multipart/form-data" id="myform"> <!-- Hidden input for storing file path --> <div class="form-control form-control-solid" style="padding-bottom: 45px !important;display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="pdfFile" name="pdfFile" accept=".pdf" required /> <button type="button" class="btn btn-success" value="Upload" id="pdf_upload">Upload <i class="fas fa-upload"></i></button> </div> </form> <div id="pdfFileErr" class="audit_error" style="color: red;"></div> <br><div id="my_resume" class="profile-skill" style="text-align: center;width: 30%; margin:0 auto;"></div> </div> <div class="col-sm-4"> <?php $result = $con->query("SELECT * FROM category WHERE category_type='Child' AND status='active'"); if (!$result) { // Query failed, handle the error die('Error in query: ' . $con->error); } ?> <label>Product Sub Category</label> <select class="form-control form-control-solid" name="subcategory" id="subcategory" > <option value="">Select Sub Category</option> <?php while ($row = $result->fetch_assoc()) { $categoryId = $row['id']; $categoryName = $row['category_name']; //echo "<option value='$categoryId'>$categoryName</option>"; } ?> </select> <div class="audit_error" style="color:red;" id="subcategoryErr"></div> </div> </div> <div class="form-group row"> <div class="col-sm-8"> <label>Product Preview Image</label><br> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="" id="tpimg" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='event_img' name="event_img"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="logofile" name="logofile" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div> <div class="audit_error" style="color:red;" id="thumb_imgErr"></div> </div> <div class="col-sm-4 mb-sm-0"> <?php $resultbrand = $con->query("SELECT * FROM brand WHERE status='active' "); if (!$resultbrand) { // Query failed, handle the error die('Error in query: ' . $con->error); } ?> <label>Brands</label> <select class="form-control js-example-basic-single form-control-solid" name="brand" id="brand" onchange="updateImage()" > <option value="">Select Brand</option> <?php while ($row = $resultbrand->fetch_assoc()) { $brandId = $row['id']; $brandlogo = $row['brandlogo']; $brandname = $row['brandname']; echo "<option value='$brandId' data-image='$brandlogo'>$brandname</option>"; } ?> </select> <div class="audit_error" style="color:red;" id="brandErr"></div> <div> <img id="selectedImage" src="" > </div> </div> </div> <div class="form-group row"> <div class="col-sm-8"> <label for="male">Product Gallery</label> <input type="hidden" id='gal_img' name="gal_img"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="padding-bottom: 45px !important;display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="galfile" name="galfile[]" multiple /> <button type="button" class="btn btn-success" value="Upload" id="gal_upload">Upload Images <i class="fas fa-upload"></i></button> </div><br> <div id="galimg"></div> </form> <div class="audit_error" style="color:red;" id="gal_imgErr"></div> </div> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Product Video Link</label> <textarea class="form-control form-control-solid" id="video_link" placeholder="Enter Youtube / Vimeo Link" name="video_link" rows="2"></textarea> <div class="audit_error" style="color:red;" id="video_linkErr"></div> </div> </div> <div class="form-group row"> <label>Product Description</label> <textarea class="form-control form-control-solid" id="description" placeholder="Description" name="description" rows="2"></textarea> <div class="audit_error" style="color:red;" id="descriptionErr"></div> <!-- <div id="summernote"></div> <div class="audit_error" style="color:red;" id="bcontentErr"></div> --> </div> <div class="form-group row"> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Highlight 1</label> <input type="text" class="form-control form-control-solid" id="Ftitle1" name="feature1" placeholder="Highlight Title1" style="margin-bottom:15px;"> <textarea class="form-control form-control-solid" id="fdescription1" placeholder="Description" name="description" rows="2"></textarea> <div class="audit_error" style="color:red;" id="descriptionErr"></div> </div> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Highlight 2</label> <input type="text" class="form-control form-control-solid" id="Ftitle2" name="feature2" placeholder="Highlight Title2" style="margin-bottom:15px;"> <textarea class="form-control form-control-solid" id="fdescription2" placeholder="Description" name="description" rows="2"></textarea> <div class="audit_error" style="color:red;" id="descriptionErr"></div> </div> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Highlight 3</label> <input type="text" class="form-control form-control-solid" id="Ftitle3" name="feature3" placeholder="Highlight Title3" style="margin-bottom:15px;"> <textarea class="form-control form-control-solid" id="fdescription3" placeholder="Description" name="description" rows="2"></textarea> <div class="audit_error" style="color:red;" id="descriptionErr"></div> </div> </div> <div class="form-group row"> <div class="col-sm-6 mb-3 mb-sm-0"> <label>Features 1</label> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="img/remove-icon.png" id="delete_feature1" style="position: absolute; top: 49px; left: 21px; display: none; width: 17px; height: 17px; cursor: pointer;"> <img src="" id="featureimg1" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='feature_img1' name="feature_img1"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="filefeature1" name="filefeature1" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload_feature1"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div><br> <div id="featuredesc1"></div> </div> <div class="col-sm-6 mb-3 mb-sm-0"> <label>Features 2</label> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="img/remove-icon.png" id="delete_feature2" style="position: absolute; top: 49px; left: 21px; display: none; width: 17px; height: 17px; cursor: pointer;"> <img src="" id="featureimg2" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='feature_img2' name="feature_img2"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="filefeature2" name="filefeature2" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload_feature2"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div><br> <div id="featuredesc2"></div> </div> </div> <div class="form-group row"> <div class="col-sm-6 mb-3 mb-sm-0"> <label>Features 3</label> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="img/remove-icon.png" id="delete_feature3" style="position: absolute; top: 49px; left: 21px; display: none; width: 17px; height: 17px; cursor: pointer;"> <img src="" id="featureimg3" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='feature_img3' name="feature_img3"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="filefeature3" name="filefeature3" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload_feature3"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div><br> <div id="featuredesc3"></div> </div> <div class="col-sm-6 mb-3 mb-sm-0"> <label>Features 4</label> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="img/remove-icon.png" id="delete_feature4" style="position: absolute; top: 49px; left: 21px; display: none; width: 17px; height: 17px; cursor: pointer;"> <img src="" id="featureimg4" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='feature_img4' name="feature_img4"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="filefeature4" name="filefeature4" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload_feature4"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div><br> <div id="featuredesc4"></div> </div> </div> <div class="form-group row"> <div class="col-sm-6 mb-3 mb-sm-0"> <label>Features 5</label> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="img/remove-icon.png" id="delete_feature5" style="position: absolute; top: 49px; left: 21px; display: none; width: 17px; height: 17px; cursor: pointer;"> <img src="" id="featureimg5" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='feature_img5' name="feature_img5"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="filefeature5" name="filefeature5" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload_feature5"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div><br> <div id="featuredesc5"></div> </div> <div class="col-sm-6 mb-3 mb-sm-0"> <label>Features 6</label><br> <div class="form-control form-control-solid" style="padding: 45px 15px !important; display: flex; align-items: center;"> <img src="img/remove-icon.png" id="delete_feature6" style="position: absolute; top: 49px; left: 21px; display: none; width: 17px; height: 17px; cursor: pointer;"> <img src="" id="featureimg6" width="50" height="50" style="margin-right:20px;" > <input type="hidden" id='feature_img6' name="feature_img6"> <form method="post" action="" enctype="multipart/form-data" id="myform"> <div class="form-control form-control-solid" style="display: grid;grid-template-columns: 1fr auto;"> <input type="file" id="filefeature6" name="filefeature6" /> <button type="button" class="btn btn-success" value="Upload" id="thumb_upload_feature6"> Upload <i class="fas fa-upload"></i></button> </div> </form> </div><br> <div id="featuredesc6"></div> </div> </div> <div class="form-group row"> <div class="col-sm-4"> <label>Price Enable/Disable</label><br> <select class="form-control form-control-solid" name="price_status" id="price_status" > <option value="">Select</option> <option value="enable">Enable</option> <option value="disable">Disable</option> </select> </div> <div class="col-sm-4"> <label for="male">MRP (Rs.)</label> <input type="text" class="form-control form-control-solid" id="mrp" name="mrp" placeholder="Enter MRP"> </div> <div class="col-sm-4"> <label for="male">Selling Price (Rs.)</label> <input type="text" class="form-control form-control-solid" id="sellprice" name="selling price" placeholder="Selling Price"> </div> </div> <div class="form-group row"> <div class="col-sm-4"> <label>Product Status</label> <select class="form-control form-control-solid" name="status" id="status" > <option value="">Select Status</option> <option value="active">Active</option> <option value="inactive">Inactive</option> </select> <div class="audit_error" style="color:red;" id="statusErr"></div> </div> <div class="col-sm-4 mb-3 mb-sm-0"> <label>Display Order</label> <input type="text" class="form-control form-control-solid" id="display" name="display" placeholder="Display Order"> <div class="audit_error" style="color:red;" id="displayErr"></div> </div> </div><br> </form> </div> </div> </div> </div> <div id="two" class=""> <div class="tab__title"> <button class="tab__button tab_button-active">Specification Details</button> <!-- <button class="tab__button" onclick="openTab('two')">Specifications</button> --> </div> <!-- <div class="col-lg-5 d-none d-lg-block bg-register-image"></div> --> <div class="col-lg-12"> <div class="ml-5"> <form class="user"> <div class="form-container" id="formContainer2"> <div class="form-group"> <div class="form-container" id="formContainer"> <div class="form-group" id="formGroup"> <div class="col-sm-5"> <div id="inputspecsGroup" class="title d-flex mb-20"> Title : <input type="text" class="form-control specification" name="specification" placeholder="Specification Title"> </div> </div> <div class="inputfield" id="inputFieldGroup" style="width: 100%;"> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <div class="form-row new-row"> <input type="text" class="form-control" name='parameter' placeholder="Parameter Name"> <input type="text" class="form-control" name='unit' placeholder="Unit"> <input type="text" class="form-control" name='val1' placeholder="Values 1"> <input type="text" class="form-control" name='val2' placeholder="Values 2"> </div> <!-- <div class="add-fields-button" onclick="addRow()" style="color: #008D42; font-weight: bold;margin-top: 15px; cursor: pointer;">Add Fields (+)</div> --> </div> <!-- <span class="btn btn-primary add-fields-button mb-20" onclick="addRow()">Add More Parameters</span> --> <hr> </div> </div><br> <div class="btn btn-primary plus-button" onclick="duplicateForm()">Add More Specs</div> </form> </div> </div> </div><br> <div class=""> <div class="tab__title"> <button class="tab__button tab_button-active">Choose Related Accessories</button> <!-- <button class="tab__button" onclick="openTab('two')">Specifications</button> --> </div> <div class="col-lg-12 mt-5" style="height: 550px;overflow-y: scroll; border: 1px solid #aaa;"> <div class="ml-5"> <div class="form-container"> <div class="form-group"> <div class="col-sm-12"> <div class="d-flex mb-20"> <div class="grid-container"> <?php $productQuery = $con->query("SELECT * FROM products WHERE category='14' and status='active' order by product_id asc"); while ($productRow = $productQuery->fetch_assoc()) { $productName = $productRow['product_title']; $machineImg = $productRow['preview_image']; $brandproID = $productRow['brandid']; $product_id = $productRow['product_id']; echo "<div class='grid-item'> <img src='{$machineImg}' class='position-relative w-90 img-shadow'> <h6>$productName</h6>"; echo "<input type='checkbox' name='related_acc' value='$product_id' />"; echo "</div>"; } ?> </div> </div> </div> </div> </div> </div> </div> </div><br> <br> <div class=""> <div class="tab__title"> <button class="tab__button tab_button-active">SEO TAGS</button> <!-- <button class="tab__button" onclick="openTab('two')">Specifications</button> --> </div> <div class="form-group row"> <div class="col-sm-10 mb-3 mb-sm-0"> <label>H1 Tag</label> <input type="text" class="form-control form-control-solid" id="h1tag" name="h1tag" placeholder="H1 Tag" > <div class="audit_error" style="color:red;" id="h1tagErr"></div> </div> </div> <div class="form-group row"> <div class="col-sm-10 mb-3 mb-sm-0"> <label>Meta Title</label> <input type="text" class="form-control form-control-solid" id="page_title" name="page-title" placeholder="Meta Title" > <div class="audit_error" style="color:red;" id="pageErr"></div> </div> </div> <div class="form-group row"> <div class="col-sm-10 mb-3 mb-sm-0"> <label>Meta Description</label> <textarea class="form-control form-control-solid" id="meta-des" placeholder="Meta Description" name="meta-des" rows="2"></textarea> <div class="audit_error" style="color:red;" id="meta-desErr"></div> </div> </div> <div class="form-group row"> <div class="col-sm-10 mb-3 mb-sm-0"> <label>Meta Keyword</label> <textarea class="form-control form-control-solid" id="meta-keyword" placeholder="Meta Keyword" name="meta-keyword" rows="2"></textarea> <div class="audit_error" style="color:red;" id="meta-tagErr"></div> </div> </div> </div><br> <div class="form-group text-center"> <button type="button" onclick="validateclient()" id="client-submit" class="btn btn-primary" value="Add Product" data-keyboard="false">Add New Product</button><br><br> <div id="succ-client-alert" style='color: green;'></div> <div id="fail-client-alert" style='color: red;'></div> </div> <style> .grid-container { display: grid; grid-template-columns: auto auto auto; padding: 10px; } .grid-item { border: 1px solid rgba(0, 0, 0, 0.8); /* padding: 50px;*/ font-size: 30px; text-align: center; margin-right: 10px; } .grid-item img { width: 200px; height: 200px; } .form-group .inputfield { display: flex; flex-wrap: wrap; width:50%; } .inputfield .form-control { width: calc(25% - 10px); margin-right: 10px; margin-bottom: 10px; box-sizing: border-box; padding: 8px; } .duplicate-button { margin-bottom: 20px; } .mt-15 .form-control{margin:15px;} .title-input { width: 100%; margin-bottom: 10px; padding: 8px; box-sizing: border-box; } </style> </div> </div> </div> <script> function deletebrouchure() { if(confirm('Are you sure you want to delete?')) { $('#pdf_path').val(''); $("#my_resume").html(""); document.getElementById('pdfFile').value= null; } } function validateclient() { if (validateclientForm() === true) { // alert('Product Add successfully') } else { alert('Please Fill The Required Fields'); } } $(document).ready(function(){ // Show delete button when an image is uploaded $('#filefeature1').change(function(){ if($(this).val() !== ''){ $('#delete_feature1').show(); } else { $('#delete_feature1').hide(); } }); // Delete uploaded image $('#delete_feature1').click(function(){ $('#featureimg1').attr('src', ''); // Clear image source $('#filefeature1').val(''); // Clear file input value $('#feature_img1').val(''); // Clear hidden input value $(this).hide(); // Hide the delete button }); }); $(document).ready(function(){ $('#filefeature2').change(function(){ if($(this).val() !== ''){ $('#delete_feature2').show(); } else { $('#delete_feature2').hide(); } }); $('#delete_feature2').click(function(){ $('#featureimg2').attr('src', ''); $('#filefeature2').val(''); $('#feature_img2').val(''); $(this).hide(); }); }); $(document).ready(function(){ $('#filefeature3').change(function(){ if($(this).val() !== ''){ $('#delete_feature3').show(); } else { $('#delete_feature3').hide(); } }); $('#delete_feature3').click(function(){ $('#featureimg3').attr('src', ''); $('#filefeature3').val(''); $('#feature_img3').val(''); $(this).hide(); }); }); $(document).ready(function(){ $('#filefeature4').change(function(){ if($(this).val() !== ''){ $('#delete_feature4').show(); } else { $('#delete_feature4').hide(); } }); $('#delete_feature4').click(function(){ $('#featureimg4').attr('src', ''); $('#filefeature4').val(''); $('#feature_img4').val(''); $(this).hide(); }); }); $(document).ready(function(){ $('#filefeature5').change(function(){ if($(this).val() !== ''){ $('#delete_feature5').show(); } else { $('#delete_feature5').hide(); } }); $('#delete_feature5').click(function(){ $('#featureimg5').attr('src', ''); $('#filefeature5').val(''); $('#feature_img5').val(''); $(this).hide(); }); }); $(document).ready(function(){ $('#filefeature6').change(function(){ if($(this).val() !== ''){ $('#delete_feature6').show(); } else { $('#delete_feature6').hide(); } }); $('#delete_feature6').click(function(){ $('#featureimg6').attr('src', ''); $('#filefeature6').val(''); $('#feature_img6').val(''); $(this).hide(); }); }); </script> <script> for(var g=1;g<=6;g++) { $('#featuredesc'+g).summernote({ placeholder: 'Feature Description', tabsize: 2, height: 150, toolbar: [ ['style', ['style']], ['font', ['bold', 'underline', 'clear']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], ['table', ['table']], ['insert', ['link', 'picture', 'video']], ['view', ['fullscreen', 'codeview', 'help']] ] }); } function addRow() { // Clone the last form row var lastRow = document.querySelector('.new-row'); var newRow = lastRow.cloneNode(true); // Clear the input values in the new row var inputs = newRow.querySelectorAll('input'); inputs.forEach(function(input) { input.value = ''; }); //$("#inputFieldGroup").next('input').append(newRow) // Append the new row to the form container document.getElementById('inputFieldGroup').appendChild(newRow); // Move the "Add Fields" button along with the new row var addButton = document.querySelector('.add-fields-button'); document.getElementById('inputFieldGroup').appendChild(addButton); } function duplicateForm() { var formContainer = document.getElementById('formContainer'); var formGroup = document.getElementById('formGroup'); // Clone the form group along with the title var newFormGroup = formGroup.cloneNode(true); // Reset values in the cloned form group newFormGroup.querySelectorAll('.form-control').forEach(function(input) { input.value = ''; }); // Append the cloned form group formContainer.appendChild(newFormGroup); } function updateImage() { var select = document.getElementById('brand'); var selectedOption = select.options[select.selectedIndex]; var image = document.getElementById('selectedImage'); image.src = selectedOption.getAttribute('data-image'); } function addFields() { var inputFieldGroup = document.getElementById('inputFieldGroup'); var newInputFieldGroup = inputFieldGroup.cloneNode(true); // Clear values in the cloned input field group newInputFieldGroup.querySelectorAll('.form-control').forEach(function(input) { input.value = ''; }); // Append the cloned input field group document.body.appendChild(newInputFieldGroup); } function openTab(tabNumber) { var i; var x = document.getElementsByClassName("tab__inside"); /*Add or Remove Active class to buttons*/ $('.tab__button').removeClass('tab_button-active'); $('.tab__button').click(function() { $(this).addClass('tab_button-active'); }) /*Add active or remove class to tab contents*/ for (i = 0; i < x.length; i++) { x[i].classList.remove("tab__inside-active"); } document.getElementById(tabNumber).classList.add("tab__inside-active"); } $(document).ready(function(){ $("#pdf_upload").click(function(){ var fd = new FormData(); var files = $('#pdfFile')[0].files[0]; fd.append('pdfFile', files); $.ajax({ url: 'api/broucher-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ // Update the hidden input with the PDF path $("#pdf_path").val(response); $("#my_resume").html("<a target='_blank' href='"+response+"'>View Brouchure</a> [ <a style='width: 10%; height: 25px;' class='btn btn-danger btn-circle btn-sm' onclick='deletebrouchure()'><i class='fas fa-trash'></i></a> ]"); // You can also update other elements or display a success message console.log("PDF Response:", response); } else { // Display an error message or handle the error as needed $("#pdfFileErr").text('File not uploaded'); } }, error: function(xhr, status, error) { console.error('AJAX Error:', status, error); } }); }); }); $(document).ready(function(){ $("#thumb_upload").click(function(){ var fd = new FormData(); var files = $('#logofile')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/thumb-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#tpimg").attr("src",response); $("#event_img").val(response); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); }); $(document).ready(function(){ $("#gal_upload").click(function(){ var fd = new FormData(); var totalfiles = document.getElementById('galfile').files.length; for (var index = 0; index < totalfiles; index++) { fd.append("files[]", document.getElementById('galfile').files[index]); } $.ajax({ url: 'api/product-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ var response = JSON.parse(response); if(response != 0){ // $('#galimg').append('<img src="'+response[index]+'" width="200px;" height="200px">'); for (var index = 0; index < response.length; ++index) { var data= response[index]; console.log("data",data); $('#galimg').append('<div id="galimgdelss'+index+'" style="float: left;"><img class="btn-delete" style="width:20px; height:20px; position: absolute;cursor: pointer;" src="img/remove-icon.png" onclick=deleteimg(\'' + data + '\',"'+index+'") /> <img src="'+data+'" width="200px;" height="200px" style="margin-right:20px;margin-bottom: 25px;"></div>'); } $("#gal_img").val(response); // $("#edit_frontimgname").val(response); // $('#galimg').html(responseObject); // $("#gal_img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); }); $("#thumb_upload_feature1").click(function(){ var fd = new FormData(); var files = $('#filefeature1')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/product-feature-image-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#featureimg1").attr("src",response); $("#feature_img1").val(response); $("#delete_feature1").show(); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); $("#thumb_upload_feature2").click(function(){ var fd = new FormData(); var files = $('#filefeature2')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/product-feature-image-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#featureimg2").attr("src",response); $("#feature_img2").val(response); $("#delete_feature2").show(); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); $("#thumb_upload_feature3").click(function(){ var fd = new FormData(); var files = $('#filefeature3')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/product-feature-image-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#featureimg3").attr("src",response); $("#feature_img3").val(response); $("#delete_feature3").show(); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); $("#thumb_upload_feature4").click(function(){ var fd = new FormData(); var files = $('#filefeature4')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/product-feature-image-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#featureimg4").attr("src",response); $("#feature_img4").val(response); $("#delete_feature4").show(); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); $("#thumb_upload_feature5").click(function(){ var fd = new FormData(); var files = $('#filefeature5')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/product-feature-image-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#featureimg5").attr("src",response); $("#feature_img5").val(response); $("#delete_feature5").show(); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); $("#thumb_upload_feature6").click(function(){ var fd = new FormData(); var files = $('#filefeature6')[0].files[0]; fd.append('file',files); $.ajax({ url: 'api/product-feature-image-upload.php', type: 'post', data: fd, contentType: false, processData: false, success: function(response){ if(response != 0){ $("#featureimg6").attr("src",response); $("#feature_img6").val(response); $("#delete_feature6").show(); // $("#img").show(); // Display image element }else{ alert('file not uploaded'); } }, }); }); function deleteimg(data,ival) { if (confirm("Are you really want to delete ?")) { $("#galimgdelss"+ival).hide(); var gallery_array =$('#gal_img').val(); var nimg = gallery_array.replace(data,''); $('#gal_img').val(nimg); } } </script> <style> /* Style for the flex container */ .flex-container { display: flex; flex-wrap: wrap; /* Allows images to wrap to the next line when there's not enough space */ } /* Style for each image container within the flex container */ .image-container { margin: 5px; /* Adjust the margin as needed */ } </style> <?php include 'footer.php'?>