Merge pull request 'raymart_branch' (#47) from raymart_branch into main
Reviewed-on: #47
This commit is contained in:
commit
5e606c9199
|
@ -9,14 +9,14 @@
|
|||
|
||||
<!-- 03-07-2024 Stacy & Raymart modified this block of code -->
|
||||
<div class="search-form d-lg-inline-block">
|
||||
<form method="POST" action="vendor-card-action.php">
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" id="search-input" class="form-control" placeholder="search.." autofocus autocomplete="off" />
|
||||
<button class="submit" type="submit" id="search-btn" class="btn btn-flat">
|
||||
<i class="mdi mdi-magnify" style="font-size:20px; color:gray; padding-right:8px;"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<form action="vendor-product-search-action.php">
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" id="search-input" class="form-control" placeholder="search for vendor with products.." autofocus autocomplete="off" />
|
||||
<button class="submit" type="submit" id="search-btn" class="btn btn-flat">
|
||||
<i class="mdi mdi-magnify" style="font-size:20px; color:gray; padding-right:8px;"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div id="search-results-container">
|
||||
<ul id="search-results"></ul>
|
||||
</div>
|
||||
|
|
|
@ -65,6 +65,7 @@ $response = editProduct(
|
|||
$color,
|
||||
$material,
|
||||
$size,
|
||||
$priceMatrix,
|
||||
$token);
|
||||
$array = json_decode($response, true);
|
||||
$_SESSION['prodictId'] = $array['_id'];
|
||||
|
|
|
@ -907,6 +907,33 @@ $vendorId = $_SESSION["vendorId"];
|
|||
)</span></label>
|
||||
<input type="number" class="form-control" id="price2" name="sale_price" value="<?php echo $array['sale_price'] ?>">
|
||||
</div>
|
||||
|
||||
<!-- 3-20-24 raymart added table for price matrix -->
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Price Matrix</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Quantity</th>
|
||||
<th scope="col">Price (PHP)</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="price-matrix-body">
|
||||
<?php foreach ($array['price_matrix'][0] as $index => $pair) : ?>
|
||||
<tr data-row-index="<?php echo $index; ?>">
|
||||
<td><input type="number" class="form-control" name="quantity[]" value="<?php echo $pair['quantity']; ?>"></td>
|
||||
<td><input type="number" class="form-control" name="price[]" value="<?php echo $pair['price']; ?>"></td>
|
||||
<td><button type="button" class="btn btn-danger delete-row">Delete</button></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<button type="button" class="btn btn-secondary" id="add-row">Add Row</button>
|
||||
</div>
|
||||
<!-- 3-20-24 raymart added table for price matrix -->
|
||||
|
||||
<!-- 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page -->
|
||||
<div class="col-md-12" style="margin: 0 0 20px 0;">
|
||||
<label class="form-label">Promo</label>
|
||||
|
@ -1021,6 +1048,100 @@ $vendorId = $_SESSION["vendorId"];
|
|||
newquill.on('text-change', function() {
|
||||
document.getElementById('short-hidden-editor').value = newquill.root.innerHTML;
|
||||
});
|
||||
|
||||
// 3-20-24 raymart added function for price matrix
|
||||
document.getElementById("add-row").addEventListener("click", function() {
|
||||
var newRow = '<tr>' +
|
||||
'<td><input type="number" class="form-control quantity-input" name="quantity[]"></td>' +
|
||||
'<td><input type="number" class="form-control" name="price[]"></td>' +
|
||||
'<td><button type="button" class="btn btn-danger delete-row">Delete</button></td>' +
|
||||
'</tr>';
|
||||
document.getElementById("price-matrix-body").insertAdjacentHTML('beforeend', newRow);
|
||||
|
||||
var quantityInputs = document.querySelectorAll('.quantity-input');
|
||||
var lastIndex = quantityInputs.length - 1;
|
||||
quantityInputs[lastIndex].addEventListener('blur', function(event) {
|
||||
checkQuantity(event, lastIndex);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("price-matrix-body").addEventListener("click", function(event) {
|
||||
if (event.target.classList.contains("delete-row")) {
|
||||
event.preventDefault();
|
||||
var rows = document.querySelectorAll("#price-matrix-body tr");
|
||||
if (rows.length > 1) {
|
||||
event.target.closest("tr").remove();
|
||||
} else {
|
||||
alert("At least one row is required.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function checkQuantity(event, index) {
|
||||
var currentInput = event.target;
|
||||
var previousRow = currentInput.parentNode.parentNode.previousElementSibling;
|
||||
var nextRow = currentInput.parentNode.parentNode.nextElementSibling;
|
||||
|
||||
if (previousRow !== null) {
|
||||
var previousQuantityInput = previousRow.querySelector('input[name="quantity[]"]');
|
||||
var currentQuantity = parseInt(currentInput.value);
|
||||
var previousQuantity = parseInt(previousQuantityInput.value);
|
||||
|
||||
if (currentQuantity <= previousQuantity) {
|
||||
alert("Quantity must be greater than the previous row's quantity.");
|
||||
currentInput.value = previousQuantity + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextRow !== null) {
|
||||
var nextQuantityInput = nextRow.querySelector('input[name="quantity[]"]');
|
||||
var nextQuantity = parseInt(nextQuantityInput.value);
|
||||
|
||||
if (currentQuantity >= nextQuantity) {
|
||||
alert("Quantity must be less than the next row's quantity.");
|
||||
currentInput.value = nextQuantity - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkExistingQuantity(row) {
|
||||
var currentInput = row.querySelector('input[name="quantity[]"]');
|
||||
var allRows = document.querySelectorAll("#price-matrix-body tr");
|
||||
var currentIndex = Array.from(allRows).indexOf(row);
|
||||
|
||||
for (var i = currentIndex - 1; i >= 0; i--) {
|
||||
var previousRow = allRows[i];
|
||||
var previousQuantityInput = previousRow.querySelector('input[name="quantity[]"]');
|
||||
var currentQuantity = parseInt(currentInput.value);
|
||||
var previousQuantity = parseInt(previousQuantityInput.value);
|
||||
|
||||
if (currentQuantity <= previousQuantity) {
|
||||
alert("Quantity must be greater than the previous row's quantity.");
|
||||
currentInput.value = previousQuantity + 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var nextRow = allRows[currentIndex + 1];
|
||||
if (nextRow !== undefined) {
|
||||
var nextQuantityInput = nextRow.querySelector('input[name="quantity[]"]');
|
||||
var nextQuantity = parseInt(nextQuantityInput.value);
|
||||
|
||||
if (currentQuantity >= nextQuantity) {
|
||||
alert("Quantity must be less than the next row's quantity.");
|
||||
currentInput.value = nextQuantity - 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("price-matrix-body").addEventListener("blur", function(event) {
|
||||
if (event.target.tagName === "INPUT" && event.target.name === "quantity[]") {
|
||||
checkExistingQuantity(event.target.closest("tr"));
|
||||
}
|
||||
}, true);
|
||||
// 3-20-24 raymart added function for price matrix
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function onload() {
|
||||
|
@ -1133,6 +1254,7 @@ $vendorId = $_SESSION["vendorId"];
|
|||
// 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename
|
||||
Promise.all(promises)
|
||||
.then(filenames => {
|
||||
// const updatedImages = existingImages.concat(filenames.map(filename => `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${filename}`));
|
||||
const updatedImages = existingImages.concat(filenames.map(filename => `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${encodeURIComponent(filename)}`));
|
||||
|
||||
if (!Array.isArray(updatedImages)) {
|
||||
|
|
|
@ -80,564 +80,12 @@ $products = productList();
|
|||
<!-- LEFT MAIN SIDEBAR -->
|
||||
<?php include 'left-main-sidebar.php' ?>
|
||||
|
||||
<!-- HEADER -->
|
||||
<?php include 'header.php' ?>
|
||||
|
||||
<!-- PAGE WRAPPER -->
|
||||
<div class="ec-page-wrapper">
|
||||
|
||||
<!-- Header -->
|
||||
<header class="ec-main-header" id="header">
|
||||
<nav class="navbar navbar-static-top navbar-expand-lg">
|
||||
<!-- Sidebar toggle button -->
|
||||
<button id="sidebar-toggler" class="sidebar-toggle"></button>
|
||||
<!-- search form -->
|
||||
<div class="search-form d-lg-inline-block">
|
||||
<div class="input-group">
|
||||
<input type="text" name="query" id="search-input" class="form-control" placeholder="search.." autofocus autocomplete="off" />
|
||||
<button type="button" name="search" id="search-btn" class="btn btn-flat">
|
||||
<i class="mdi mdi-magnify"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="search-results-container">
|
||||
<ul id="search-results"></ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- navbar right -->
|
||||
<div class="navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- User Account -->
|
||||
<li class="dropdown user-menu">
|
||||
<button class="dropdown-toggle nav-link ec-drop" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<img src="assets/img/user/user.png" class="user-image" alt="User Image" />
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right ec-dropdown-menu">
|
||||
<!-- User image -->
|
||||
<li class="dropdown-header">
|
||||
<img src="assets/img/user/user.png" class="img-circle" alt="User Image" />
|
||||
<div class="d-inline-block">
|
||||
John Deo <small class="pt-1">john.example@gmail.com</small>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="user-profile.html">
|
||||
<i class="mdi mdi-account"></i> My Profile
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="mdi mdi-email"></i> Message
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"> <i class="mdi mdi-diamond-stone"></i> Projects </a>
|
||||
</li>
|
||||
<li class="right-sidebar-in">
|
||||
<a href="javascript:0"> <i class="mdi mdi-settings-outline"></i> Setting </a>
|
||||
</li>
|
||||
<li class="dropdown-footer">
|
||||
<a href="/logout.php"> <i class="mdi mdi-logout"></i> Log Out </a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown notifications-menu custom-dropdown">
|
||||
<button class="dropdown-toggle notify-toggler custom-dropdown-toggler">
|
||||
<i class="mdi mdi-bell-outline"></i>
|
||||
</button>
|
||||
|
||||
<div class="card card-default dropdown-notify dropdown-menu-right mb-0">
|
||||
<div class="card-header card-header-border-bottom px-3">
|
||||
<h2>Notifications</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-body px-0 py-0">
|
||||
<ul class="nav nav-tabs nav-style-border p-0 justify-content-between" id="myTab" role="tablist">
|
||||
<li class="nav-item mx-3 my-0 py-0">
|
||||
<a href="#" class="nav-link active pb-3" id="home2-tab" data-bs-toggle="tab" data-bs-target="#home2" role="tab" aria-controls="home2" aria-selected="true">All (10)</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item mx-3 my-0 py-0">
|
||||
<a href="#" class="nav-link pb-3" id="profile2-tab" data-bs-toggle="tab" data-bs-target="#profile2" role="tab" aria-controls="profile2" aria-selected="false">Msgs (5)</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item mx-3 my-0 py-0">
|
||||
<a href="#" class="nav-link pb-3" id="contact2-tab" data-bs-toggle="tab" data-bs-target="#contact2" role="tab" aria-controls="contact2" aria-selected="false">Others (5)</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" id="myTabContent3">
|
||||
<div class="tab-pane fade show active" id="home2" role="tabpanel">
|
||||
<ul class="list-unstyled" data-simplebar style="height: 360px">
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u2.jpg" alt="Image">
|
||||
<span class="status away"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Nitin</h4>
|
||||
<p class="last-msg">Lorem ipsum dolor sit, amet
|
||||
consectetur adipisicing elit. Nam itaque
|
||||
doloremque odio, eligendi delectus vitae.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 30 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification media-active">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u1.jpg" alt="Image">
|
||||
<span class="status active"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Lovina</h4>
|
||||
<p class="last-msg">Donec mattis augue a nisl
|
||||
consequat, nec imperdiet ex rutrum. Fusce et
|
||||
vehicula enim. Sed in enim eu odio vehic.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-white">
|
||||
<i class="mdi mdi-clock-outline"></i> Just
|
||||
now...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u5.jpg" alt="Image">
|
||||
<span class="status away"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Crinali</h4>
|
||||
<p class="last-msg">Lorem ipsum dolor sit, amet
|
||||
consectetur adipisicing elit. Nam itaque
|
||||
doloremque odio, eligendi delectus vitae.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification event-active">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-info text-white">
|
||||
<i class="mdi mdi-calendar-check font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Upcomming event added</h4>
|
||||
<p class="last-msg font-size-14">03/Jan/2020 (1pm -
|
||||
2pm)</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 10 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-warning text-white">
|
||||
<i class="mdi mdi-chart-areaspline font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Yearly Sales report</h4>
|
||||
<p class="last-msg font-size-14">Lorem ipsum dolor
|
||||
sit, amet consectetur adipisicing elit. Nam
|
||||
itaque doloremque odio, eligendi delectus vitae.
|
||||
</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-primary text-white">
|
||||
<i class="mdi mdi-account-multiple-check font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">New request</h4>
|
||||
<p class="last-msg font-size-14">Add Dany Jones as
|
||||
your contact consequat nec imperdiet ex rutrum.
|
||||
Fusce et vehicula enim. Sed in enim.</p>
|
||||
|
||||
<span class="my-1 btn btn-sm btn-success">Accept</span>
|
||||
<span class="my-1 btn btn-sm btn-secondary">Delete</span>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary d-block">
|
||||
<i class="mdi mdi-clock-outline"></i> 5 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-danger text-white">
|
||||
<i class="mdi mdi-server-network-off font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Server overloaded</h4>
|
||||
<p class="last-msg font-size-14">Donec mattis augue
|
||||
a nisl consequat, nec imperdiet ex rutrum. Fusce
|
||||
et vehicula enim. Sed in enim eu odio vehic.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 30 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-purple text-white">
|
||||
<i class="mdi mdi-playlist-check font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Task complete</h4>
|
||||
<p class="last-msg font-size-14">Nam ut nisi erat.
|
||||
Ut quis tortor varius, hendrerit arcu quis,
|
||||
congue nisl. In scelerisque, sem ut ve.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 2 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="profile2" role="tabpanel">
|
||||
<ul class="list-unstyled" data-simplebar style="height: 360px">
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u6.jpg" alt="Image">
|
||||
<span class="status away"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Hardiko</h4>
|
||||
<p class="last-msg">Donec mattis augue a nisl
|
||||
consequat, nec imperdiet ex rutrum. Fusce et
|
||||
vehicula enim. Sed in enim eu odio vehic.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u7.jpg" alt="Image">
|
||||
<span class="status away"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Browin</h4>
|
||||
<p class="last-msg">Nam ut nisi erat. Ut quis tortor
|
||||
varius, hendrerit arcu quis, congue nisl. In
|
||||
scelerisque, sem ut ve.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification media-active">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u1.jpg" alt="Image">
|
||||
<span class="status active"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">jenelia</h4>
|
||||
<p class="last-msg">Donec mattis augue a nisl
|
||||
consequat, nec imperdiet ex rutrum. Fusce et
|
||||
vehicula enim. Sed in enim eu odio vehic.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-white">
|
||||
<i class="mdi mdi-clock-outline"></i> Just
|
||||
now...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u2.jpg" alt="Image">
|
||||
<span class="status away"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Bhavlio</h4>
|
||||
<p class="last-msg">Lorem ipsum dolor sit, amet
|
||||
consectetur adipisicing elit. Nam itaque
|
||||
doloremque odio, eligendi delectus vitae.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
<div class="position-relative mr-3">
|
||||
<img class="rounded-circle" src="assets/img/user/u5.jpg" alt="Image">
|
||||
<span class="status away"></span>
|
||||
</div>
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Browini</h4>
|
||||
<p class="last-msg">Lorem ipsum dolor sit, amet
|
||||
consectetur adipisicing elit. Nam itaque
|
||||
doloremque odio, eligendi delectus vitae.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="contact2" role="tabpanel">
|
||||
<ul class="list-unstyled" data-simplebar style="height: 360px">
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification event-active">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-info text-white">
|
||||
<i class="mdi mdi-calendar-check font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Upcomming event added</h4>
|
||||
<p class="last-msg font-size-14">03/Jan/2020 (1pm -
|
||||
2pm)</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 10 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-warning text-white">
|
||||
<i class="mdi mdi-chart-areaspline font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">New Sales report</h4>
|
||||
<p class="last-msg font-size-14">Lorem ipsum dolor
|
||||
sit, amet consectetur adipisicing elit. Nam
|
||||
itaque doloremque odio, eligendi delectus vitae.
|
||||
</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 1 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-primary text-white">
|
||||
<i class="mdi mdi-account-multiple-check font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">New Request</h4>
|
||||
<p class="last-msg font-size-14">Add Dany Jones as
|
||||
your contact consequat nec imperdiet ex rutrum.
|
||||
Fusce et vehicula enim. Sed in enim.</p>
|
||||
|
||||
<span class="my-1 btn btn-sm btn-success">Accept</span>
|
||||
<span class="my-1 btn btn-sm btn-secondary">Delete</span>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary d-block">
|
||||
<i class="mdi mdi-clock-outline"></i> 5 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-danger text-white">
|
||||
<i class="mdi mdi-server-network-off font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">Server overloaded</h4>
|
||||
<p class="last-msg font-size-14">Donec mattis augue
|
||||
a nisl consequat, nec imperdiet ex rutrum. Fusce
|
||||
et vehicula enim. Sed in enim eu odio vehic.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 30 min
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javscript:void(0)" class="media media-message media-notification">
|
||||
|
||||
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-purple text-white">
|
||||
<i class="mdi mdi-playlist-check font-size-20"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-body d-flex justify-content-between">
|
||||
<div class="message-contents">
|
||||
<h4 class="title">New Task complete</h4>
|
||||
<p class="last-msg font-size-14">Nam ut nisi erat.
|
||||
Ut quis tortor varius, hendrerit arcu quis,
|
||||
congue nisl. In scelerisque, sem ut ve.</p>
|
||||
|
||||
<span class="font-size-12 font-weight-medium text-secondary">
|
||||
<i class="mdi mdi-clock-outline"></i> 2 hrs
|
||||
ago...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-right d-none">
|
||||
<li class="dropdown-header">You have 5 notifications</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="mdi mdi-account-plus"></i> New user registered
|
||||
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 10 AM</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="mdi mdi-account-remove"></i> User deleted
|
||||
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 07 AM</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="mdi mdi-chart-areaspline"></i> Sales report is ready
|
||||
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 12 PM</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="mdi mdi-account-supervisor"></i> New client
|
||||
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 10 AM</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="mdi mdi-server-network-off"></i> Server overloaded
|
||||
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 05 AM</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown-footer">
|
||||
<a class="text-center" href="#"> View All </a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="right-sidebar-in right-sidebar-2-menu">
|
||||
<i class="mdi mdi-settings-outline mdi-spin"></i>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- CONTENT WRAPPER -->
|
||||
<div class="ec-content-wrapper ec-vendor-wrapper">
|
||||
<div class="content">
|
||||
|
@ -651,8 +99,16 @@ $products = productList();
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card card-default p-4 ec-card-space">
|
||||
<div class="col-lg-6 col-md-12">
|
||||
<form style="display:flex; margin-bottom:50px;" method="POST" action="vendor-card-action.php">
|
||||
<input type="text" name="search" class="form-control" id="searchProduct" placeholder="search with vendor name..">
|
||||
<button class="submit" type="submit" id="search-btn" class="btn btn-flat">
|
||||
<i class="mdi mdi-magnify" style="font-size:20px; color:gray; margin-left:-40px;"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="ec-vendor-card mt-m-24px row">
|
||||
|
||||
<?php
|
||||
|
@ -665,6 +121,27 @@ $products = productList();
|
|||
$start = ($currentpage - 1) * $vendorsPerPage;
|
||||
$end = $start + $vendorsPerPage - 1;
|
||||
|
||||
$vendorsCopy = $vendors;
|
||||
|
||||
if (!empty($_GET['search']) ) {
|
||||
$filteredProducts=[];
|
||||
foreach ($vendorsCopy as $result) {
|
||||
$vendorName = strtolower($result['user_login']);
|
||||
if (
|
||||
strpos($vendorName,$_GET['search'])!==false
|
||||
) {
|
||||
$filteredProducts[] = $result;
|
||||
} else{
|
||||
}
|
||||
}
|
||||
|
||||
$vendors = $filteredProducts;
|
||||
$totalVendors = count($filteredProducts);
|
||||
// $vendorsPerPage = 20;
|
||||
}
|
||||
if ($totalVendors == 0) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Vendor Found.</p>';
|
||||
}
|
||||
// $vendors = vendorList();
|
||||
for ($x = $start; $x <= $end && $x < $totalVendors; $x++) {
|
||||
$vendor = $vendors[$x];
|
||||
|
@ -684,7 +161,7 @@ $products = productList();
|
|||
if (isset($vendor['vendor_image']) && !empty($vendor['vendor_image'])) {
|
||||
echo '<img src="' . $vendor['vendor_image'] . '" class="img-fluid rounded-circle" alt="Avatar Image" style="width: 150px; height: 150px; object-fit: cover; border-radius: 50%;"> ';
|
||||
} else {
|
||||
echo '<img src="assets/img/vendor/u1.jpg" class="img-fluid rounded-circle" alt="Placeholder Image">';
|
||||
echo '<img src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" class="img-fluid rounded-circle" alt="Placeholder Image">';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -694,15 +171,15 @@ $products = productList();
|
|||
<ul class="list-unstyled">
|
||||
<li class="d-flex mb-1">
|
||||
<i class="mdi mdi-cellphone-basic mr-1"></i>
|
||||
<span>
|
||||
<span style="font-size:13px;">
|
||||
<?php
|
||||
echo isset($vendor['phone']) && !empty($vendor['phone']) ? $vendor['phone'] : 'No Number yet';
|
||||
echo isset($vendor['phone']) && !empty($vendor['phone']) ? $vendor['phone']: 'No Number yet';
|
||||
?>
|
||||
</span>
|
||||
</li>
|
||||
<li class="d-flex">
|
||||
<i class="mdi mdi-email mr-1"></i>
|
||||
<span>
|
||||
<span style="font-size:13px;">
|
||||
<?php
|
||||
echo isset($vendor['user_email']) && !empty($vendor['user_email']) ? $vendor['user_email'] : 'No Email yet';
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
include "../functions.php";
|
||||
|
||||
$productId = $_SESSION['productId'];
|
||||
$vendorId = $_SESSION['vendorId'];
|
||||
//echo '$vendorId: '.$vendorId.'<br>';
|
||||
$productName = $_POST['product_name'];
|
||||
//echo '$productName: '.$productName.'<br>';
|
||||
$stock = $_POST['stock'];
|
||||
// 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page Action
|
||||
$ndd = isset($_POST['promo']['next-day-delivery']) ? $_POST['promo']['next-day-delivery'] : 'No';
|
||||
$sdd = isset($_POST['promo']['same-day-delivery']) ? $_POST['promo']['same-day-delivery'] : 'No';
|
||||
$freeSf = isset($_POST['promo']['free-shipping']) ? $_POST['promo']['free-shipping'] : 'No';
|
||||
// 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page Action
|
||||
$minimumOrder = $_POST['minimum_order'];
|
||||
//echo '$stock: '.$stock.'<br>';
|
||||
$price = $_POST['regular_price'];
|
||||
//echo '$price: '.$price.'<br>';
|
||||
$salePrice = $_POST['sale_price'];
|
||||
//echo '$salePrice: '.$salePrice.'<br>';
|
||||
$weight = $_POST['weight'];
|
||||
$length = $_POST['length'];
|
||||
$width = $_POST['width'];
|
||||
$height = $_POST['height'];
|
||||
$description = $_POST['product_description'];
|
||||
$specifications = $_POST['specifications'];
|
||||
//echo '$specifications: '.$specifications.'<br>';
|
||||
$productType = $_POST['product_type'];
|
||||
$productCategory = $_POST['product_category'];
|
||||
$productSf = $_POST['shipping_fee'];
|
||||
$productStatus = $_POST['status'];
|
||||
//echo '$productType: '.$productType.'<br>';
|
||||
$parentId = $_POST['parent_id'];
|
||||
//echo '$parentId: '.$parentId.'<br>';
|
||||
$size = $_POST['size'];
|
||||
//echo '$size: '.$size.'<br>';
|
||||
$color = $_POST['color'];
|
||||
//echo '$color: '.$color.'<br>';
|
||||
$material = $_POST['material'];
|
||||
//echo '$material: '.$material.'<br>';
|
||||
$token = $_SESSION["token"];
|
||||
|
||||
$response = editProduct(
|
||||
$productId,
|
||||
$vendorId,
|
||||
$productName,
|
||||
$stock,
|
||||
$ndd,
|
||||
$sdd,
|
||||
$freeSf,
|
||||
$price,
|
||||
$salePrice,
|
||||
$weight,
|
||||
$length,
|
||||
$width,
|
||||
$height,
|
||||
$description,
|
||||
$specifications,
|
||||
$productType,
|
||||
$productCategory,
|
||||
$productSf,
|
||||
$productStatus,
|
||||
$parentId,
|
||||
$minimumOrder,
|
||||
$color,
|
||||
$material,
|
||||
$size,
|
||||
$priceMatrix,
|
||||
$token);
|
||||
$array = json_decode($response, true);
|
||||
$_SESSION['prodictId'] = $array['_id'];
|
||||
header("location: vendor-product-search.php");
|
||||
?>
|
|
@ -0,0 +1,726 @@
|
|||
<?php
|
||||
include "../functions.php";
|
||||
|
||||
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
|
||||
$vendorId = $_SESSION["vendorId"];
|
||||
if ($_SESSION["userId"] <> "") {
|
||||
$_SESSION["isLoggedIn"] = true;
|
||||
|
||||
} else {
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
exit();
|
||||
}
|
||||
if ($_SESSION["user_type"] != "admin") {
|
||||
header("location: login.php?alert=Only admins allowed here!");
|
||||
}
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$_SESSION['productId'] = $_GET['id'];
|
||||
}
|
||||
$result = getProduct($_SESSION['productId']);
|
||||
$array = json_decode($result, true);
|
||||
$_SESSION["vendorId"] = $array['vendor_api_id'];
|
||||
$vendorId = $_SESSION["vendorId"];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="oBanana B2B - Admin Dashboard">
|
||||
|
||||
<title>oBanana B2B - Admin Dashboard</title>
|
||||
|
||||
<!-- GOOGLE FONTS -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@200;300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700;800;900&family=Roboto:wght@400;500;700;900&display=swap" rel="stylesheet">
|
||||
|
||||
<link href="https://cdn.materialdesignicons.com/4.4.95/css/materialdesignicons.min.css" rel="stylesheet" />
|
||||
|
||||
<!-- PLUGINS CSS STYLE -->
|
||||
<link href="assets/plugins/simplebar/simplebar.css" rel="stylesheet" />
|
||||
|
||||
<!-- ekka CSS -->
|
||||
<link id="ekka-css" rel="stylesheet" href="assets/css/ekka.css" />
|
||||
|
||||
<!-- FAVICON -->
|
||||
<link href="assets/img/favicon.png" rel="shortcut icon" />
|
||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
<body class="ec-header-fixed ec-sidebar-fixed ec-sidebar-dark ec-header-light" id="body" onload="onload()">
|
||||
<!-- WRAPPER -->
|
||||
<div class="wrapper">
|
||||
|
||||
<!-- LEFT MAIN SIDEBAR -->
|
||||
<?php include 'left-main-sidebar.php' ?>
|
||||
|
||||
<!-- HEADER -->
|
||||
<?php include 'header.php' ?>
|
||||
|
||||
<!-- PAGE WRAPPER -->
|
||||
<div class="ec-page-wrapper">
|
||||
|
||||
<!-- CONTENT WRAPPER -->
|
||||
<div class="ec-content-wrapper">
|
||||
<div class="content">
|
||||
<div class="breadcrumb-wrapper d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h1>Add Product</h1>
|
||||
<p class="breadcrumbs"><span><a href="index.php">Home</a></span>
|
||||
<span><i class="mdi mdi-chevron-right"></i></span><span><a href="vendor-card.php">Vendors</a></span>
|
||||
<span><i class="mdi mdi-chevron-right"></i></span><span><a href="vendor-profile.php">Profile</a></span>
|
||||
<span><i class="mdi mdi-chevron-right"></i></span><span><a href="vendor-product-grid.php">Products</a></span>
|
||||
<span><i class="mdi mdi-chevron-right"></i></span>Add
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-default">
|
||||
<div class="card-header card-header-border-bottom">
|
||||
<h2>Add Product</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row ec-vendor-uploads">
|
||||
<div class="col-lg-4">
|
||||
<div class="ec-vendor-img-upload">
|
||||
<div class="ec-vendor-main-img">
|
||||
<div class="avatar-upload">
|
||||
<div class="avatar-edit">
|
||||
<input type='file' id="imageUpload" class="ec-image-upload" accept=".png, .jpg, .jpeg" multiple onchange="uploadProductImage()" />
|
||||
<label for="imageUpload"><img src="assets/img/icons/edit.svg" class="svg_img header_svg" alt="edit" /></label>
|
||||
</div>
|
||||
<div class="avatar-preview ec-preview">
|
||||
<div class="imagePreview ec-div-preview">
|
||||
<?php
|
||||
if (isset($array['images'])) {
|
||||
$image_urls = explode(',', $array['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img class="ec-image-preview" src="<?php echo $first_image_url; ?>" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img class="ec-image-preview" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thumb-upload-set colo-md-12">
|
||||
<?php
|
||||
if (isset($array['images'])) {
|
||||
$image_urls = explode(',', $array['images']);
|
||||
foreach ($image_urls as $index => $image_url) {
|
||||
$image_url = trim($image_url);
|
||||
?>
|
||||
<div class="thumb-upload">
|
||||
<div class="thumb-edit">
|
||||
<button class="delete-image-button" onclick="deleteImage('<?php echo $array['_id']; ?>', <?php echo $index; ?>)">
|
||||
<i class="mdi mdi-delete" style="font-size:16px; color: black; background-color:white; border-radius:3px;"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="thumb-preview ec-preview">
|
||||
<div class="image-thumb-preview">
|
||||
<img class="" src="<?php echo $image_url; ?>" alt="edit" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<div class="thumb-upload">
|
||||
<div class="thumb-edit">
|
||||
<input type='file' id="thumbUpload" class="ec-image-upload" accept=".png, .jpg, .jpeg" />
|
||||
<label for="thumbUpload"><i class="fi-rr-edit"></i></label>
|
||||
</div>
|
||||
<div class="thumb-preview ec-preview">
|
||||
<div class="image-thumb-preview">
|
||||
<img class="image-thumb-preview ec-image-preview" src="assets/images/product-image/vender-upload-thumb-preview.jpg" alt="edit" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
function deleteImage(productId, indexToDelete) {
|
||||
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId)
|
||||
.then(response => response.json())
|
||||
.then(product => {
|
||||
let imagesArray = product.images.split(',');
|
||||
if (indexToDelete >= 0 && indexToDelete < imagesArray.length) {
|
||||
imagesArray.splice(indexToDelete, 1);
|
||||
}
|
||||
const updatedImages = imagesArray.join(',');
|
||||
const payload = {
|
||||
images: updatedImages,
|
||||
};
|
||||
const token = '<?php echo $_SESSION["token"] ?>';
|
||||
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token,
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Image deleted successfully');
|
||||
location.reload();
|
||||
} else {
|
||||
console.error('Image deletion failed');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during image deletion:', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-8">
|
||||
<div class="ec-vendor-upload-detail">
|
||||
<form action="vendor-edit-product-action.php" method="post">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label for="inputEmail4" class="form-label">Product name</label>
|
||||
<input type="text" class="form-control" id="inputEmail4" name="product_name" value="<?php echo $array['product_name']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Product Type</label>
|
||||
<select id="Categories" class="form-select" name="product_type" onchange="variables()">
|
||||
<option value="simple" <?php if ($array['product_type'] == 'simple') {
|
||||
echo 'selected';
|
||||
} ?>>Simple</option>
|
||||
<option value="variable" <?php if ($array['product_type'] == 'variable') {
|
||||
echo 'selected';
|
||||
} ?>>Variable</option>
|
||||
<option value="variation" <?php if ($array['product_type'] == 'variation') {
|
||||
echo 'selected';
|
||||
} ?>>Variation</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row collapse" id="variation">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Parent Id</label>
|
||||
<select class="form-select" name="parent_id" id="variation-type-select">
|
||||
<!-- Your variation options go here -->
|
||||
<option value="" disabled selected>Select Product</option>
|
||||
<?php
|
||||
$products = productListVendor($vendorId);
|
||||
foreach ($products as $product) {
|
||||
// Check if the product type matches the selected product type
|
||||
if ($product['product_type'] == "variable") {
|
||||
if ($product['_id'] == $array['parent_id']) {
|
||||
echo '<option value="' . $product['_id'] . '" selected >' . $product['product_name'] . '</option>';
|
||||
} else {
|
||||
echo '<option value="' . $product['_id'] . '">' . $product['product_name'] . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<!-- <label class="form-label">Colors</label>
|
||||
<input type="color" class="form-control form-control-color" id="exampleColorInput1" value="#ff6191" title="Choose your color">
|
||||
<input type="color" class="form-control form-control-color" id="exampleColorInput2" value="#33317d" title="Choose your color">
|
||||
<input type="color" class="form-control form-control-color" id="exampleColorInput3" value="#56d4b7" title="Choose your color">
|
||||
<input type="color" class="form-control form-control-color" id="exampleColorInput4" value="#009688" title="Choose your color"> -->
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Size</label>
|
||||
<select class="form-select" name="size" id="size">
|
||||
<!-- Your variation options go here -->
|
||||
<option value="">Select Size</option>
|
||||
<option value="XS" <?php echo ($array['variants'][0]['size'] === 'XS') ? 'selected' : ''; ?>>XS</option>
|
||||
<option value="S" <?php echo ($array['variants'][0]['size'] === 'S') ? 'selected' : ''; ?>>S</option>
|
||||
<option value="M" <?php echo ($array['variants'][0]['size'] === 'M') ? 'selected' : ''; ?>>M</option>
|
||||
<option value="L" <?php echo ($array['variants'][0]['size'] === 'L') ? 'selected' : ''; ?>>L</option>
|
||||
<option value="XL" <?php echo ($array['variants'][0]['size'] === 'XL') ? 'selected' : ''; ?>>XL</option>
|
||||
<option value="XXL" <?php echo ($array['variants'][0]['size'] === 'XXL') ? 'selected' : ''; ?>>XXL</option>
|
||||
<option value="XXXL" <?php echo ($array['variants'][0]['size'] === 'XXXL') ? 'selected' : ''; ?>>XXXL</option>
|
||||
</select>
|
||||
<!-- <label class="form-label">Size</label>
|
||||
<div class="form-checkbox-box">
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" name="size1" value="size">
|
||||
<label>S</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" name="size1" value="size">
|
||||
<label>M</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" name="size1" value="size">
|
||||
<label>L</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" name="size1" value="size">
|
||||
<label>XL</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" name="size1" value="size">
|
||||
<label>XXL</label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="Color" class="form-label">Color</label>
|
||||
<input type="text" class="form-control slug-title" id="color" name="color" value="<?php echo $array['variants'][0]['color']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="Material" class="form-label">Material</label>
|
||||
<input type="text" class="form-control slug-title" id="material" name="material" value="<?php echo $array['variants'][0]['material']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label for="slug" class="col-12 col-form-label">Slug</label>
|
||||
<div class="col-12">
|
||||
<input id="slug" name="slug" class="form-control here set-slug" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="weight" class="form-label">Weight(g)</label>
|
||||
<input type="number" class="form-control slug-title" id="width" name="weight" value="<?php echo $array['weight']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="length" class="form-label">Length(cm)</label>
|
||||
<input type="number" class="form-control slug-title" id="length" name="length" value="<?php echo $array['length']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="width" class="form-label">Width(cm)</label>
|
||||
<input type="number" class="form-control slug-title" id="width" name="width" value="<?php echo $array['width']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <label for="height" class="form-label">Height</label> -->
|
||||
<!-- raymart edit height -->
|
||||
<label for="height" class="form-label">Height(cm)</label>
|
||||
<input type="number" class="form-control slug-title" id="height" name="height" value="<?php echo $array['height']; ?>">
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Short Description</label>
|
||||
<textarea class="form-control" name="product_description" id="short-hidden-editor" style="display: none;" rows="2"><?php echo $array['product_description'] ?></textarea>
|
||||
<div id="short-editor-container" style="height: 200px;"><?php echo $array['product_description'] ?></div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Regular Price <span>( In PHP
|
||||
)</span></label>
|
||||
<input type="number" class="form-control" id="price1" name="regular_price" value="<?php echo $array['regular_price'] ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Sale Price <span>( In PHP
|
||||
)</span></label>
|
||||
<input type="number" class="form-control" id="price2" name="sale_price" value="<?php echo $array['sale_price'] ?>">
|
||||
</div>
|
||||
|
||||
<!-- 3-20-24 raymart added table for price matrix -->
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Price Matrix</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Quantity</th>
|
||||
<th scope="col">Price (PHP)</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="price-matrix-body">
|
||||
<?php foreach ($array['price_matrix'][0] as $index => $pair) : ?>
|
||||
<tr data-row-index="<?php echo $index; ?>">
|
||||
<td><input type="number" class="form-control" name="quantity[]" value="<?php echo $pair['quantity']; ?>"></td>
|
||||
<td><input type="number" class="form-control" name="price[]" value="<?php echo $pair['price']; ?>"></td>
|
||||
<td><button type="button" class="btn btn-danger delete-row">Delete</button></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<button type="button" class="btn btn-secondary" id="add-row">Add Row</button>
|
||||
</div>
|
||||
<!-- 3-20-24 raymart added table for price matrix -->
|
||||
|
||||
<!-- 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page -->
|
||||
<div class="col-md-12" style="margin: 0 0 20px 0;">
|
||||
<label class="form-label">Promo</label>
|
||||
<div class="row" justify-content-between>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="nextDayDeliveryCheckbox" name="promo[next-day-delivery]" value="Yes" <?php if ($array['promo'][0]['next-day-delivery'] === "Yes") echo "checked"; ?> style="background-color: blue;">
|
||||
<label class="form-check-label" for="nextDayDeliveryCheckbox">Next Day Delivery</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="sameDayDeliveryCheckbox" name="promo[same-day-delivery]" value="Yes" <?php if ($array['promo'][0]['same-day-delivery'] === "Yes") echo "checked"; ?> style="background-color: blue;">
|
||||
<label class="form-check-label" for="sameDayDeliveryCheckbox">Same Day Delivery</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="freeShippingCheckbox" name="promo[free-shipping]" value="Yes" <?php if ($array['promo'][0]['free-shipping'] === "Yes") echo "checked"; ?> style="background-color: blue;">
|
||||
<label class="form-check-label" for="freeShippingCheckbox">Free Shipping</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page -->
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Stock</label>
|
||||
<input type="number" class="form-control" id="quantity1" name="stock" value="<?php echo $array['stock'] ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Minimum Order</label>
|
||||
<input type="number" class="form-control" id="minOrder" name="minimum_order" value="<?php echo $array['minimum_order'] ?>">
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Full Detail</label>
|
||||
<textarea class="form-control" rows="4" name="specifications" id="hidden-editor" style="display: none;"><?php echo $array['specifications'] ?></textarea>
|
||||
<div id="editor-container" style="height: 200px;"><?php echo $array['specifications'] ?></div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Product Category</label>
|
||||
<select class="form-select" name="product_category" id="product_category">
|
||||
<option value="">Select Category</option>
|
||||
<option value="Electronics" <?php echo ($array['product_category'] === 'Electronics') ? 'selected' : ''; ?>>Electronics</option>
|
||||
<option value="Solar" <?php echo ($array['product_category'] === 'Solar') ? 'selected' : ''; ?>>Solar</option>
|
||||
<option value="E-bike" <?php echo ($array['product_category'] === 'E-bike') ? 'selected' : ''; ?>>E-bike</option>
|
||||
<option value="E-vehicle" <?php echo ($array['product_category'] === 'E-vehicle') ? 'selected' : ''; ?>>E-Vehicle</option>
|
||||
<option value="Appliance" <?php echo ($array['product_category'] === 'Appliance') ? 'selected' : ''; ?>>Appliance</option>
|
||||
<option value="Smart Home" <?php echo ($array['product_category'] === 'Smart Home') ? 'selected' : ''; ?>>Smart Home</option>
|
||||
<option value="Home" <?php echo ($array['product_category'] === 'Home') ? 'selected' : ''; ?>>Home</option>
|
||||
<option value="Heavy Equipment" <?php echo ($array['product_category'] === 'Heavy Equipment') ? 'selected' : ''; ?>>Heavy Equipment</option>
|
||||
<option value="Apparel" <?php echo ($array['product_category'] === 'Apparel') ? 'selected' : ''; ?>>Apparel</option>
|
||||
<option value="Petcare" <?php echo ($array['product_category'] === 'Petcare') ? 'selected' : ''; ?>>Petcare</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Shipping Fee</label>
|
||||
<input type="number" class="form-control" id="sfee" name="shipping_fee" value="<?php echo $array['shipping_fee'] ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Product Status</label>
|
||||
<select class="form-select" name="status" id="status">
|
||||
<option value="">Select Product Status</option>
|
||||
<option value="Active" <?php echo ($array['status'] === 'Active') ? 'selected' : ''; ?>>Active</option>
|
||||
<option value="Inactive" <?php echo ($array['status'] === 'Inactive') ? 'selected' : ''; ?>>Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Product Tags <span>( Type and
|
||||
make comma to separate tags )</span></label>
|
||||
<input type="text" class="form-control" id="group_tag" name="group_tag" value="" placeholder="" data-role="tagsinput" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- End Content -->
|
||||
</div> <!-- End Content Wrapper -->
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var quill = new Quill('#editor-container', {
|
||||
theme: 'snow'
|
||||
});
|
||||
quill.clipboard.dangerouslyPasteHTML(document.getElementById('hidden-editor').value);
|
||||
quill.on('text-change', function() {
|
||||
document.getElementById('hidden-editor').value = quill.root.innerHTML;
|
||||
});
|
||||
|
||||
var newquill = new Quill('#short-editor-container', {
|
||||
theme: 'snow'
|
||||
});
|
||||
newquill.clipboard.dangerouslyPasteHTML(document.getElementById('short-hidden-editor').value);
|
||||
newquill.on('text-change', function() {
|
||||
document.getElementById('short-hidden-editor').value = newquill.root.innerHTML;
|
||||
});
|
||||
|
||||
// 3-20-24 raymart added function for price matrix
|
||||
document.getElementById("add-row").addEventListener("click", function() {
|
||||
var newRow = '<tr>' +
|
||||
'<td><input type="number" class="form-control quantity-input" name="quantity[]"></td>' +
|
||||
'<td><input type="number" class="form-control" name="price[]"></td>' +
|
||||
'<td><button type="button" class="btn btn-danger delete-row">Delete</button></td>' +
|
||||
'</tr>';
|
||||
document.getElementById("price-matrix-body").insertAdjacentHTML('beforeend', newRow);
|
||||
|
||||
var quantityInputs = document.querySelectorAll('.quantity-input');
|
||||
var lastIndex = quantityInputs.length - 1;
|
||||
quantityInputs[lastIndex].addEventListener('blur', function(event) {
|
||||
checkQuantity(event, lastIndex);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("price-matrix-body").addEventListener("click", function(event) {
|
||||
if (event.target.classList.contains("delete-row")) {
|
||||
event.preventDefault();
|
||||
var rows = document.querySelectorAll("#price-matrix-body tr");
|
||||
if (rows.length > 1) {
|
||||
event.target.closest("tr").remove();
|
||||
} else {
|
||||
alert("At least one row is required.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function checkQuantity(event, index) {
|
||||
var currentInput = event.target;
|
||||
var previousRow = currentInput.parentNode.parentNode.previousElementSibling;
|
||||
var nextRow = currentInput.parentNode.parentNode.nextElementSibling;
|
||||
|
||||
if (previousRow !== null) {
|
||||
var previousQuantityInput = previousRow.querySelector('input[name="quantity[]"]');
|
||||
var currentQuantity = parseInt(currentInput.value);
|
||||
var previousQuantity = parseInt(previousQuantityInput.value);
|
||||
|
||||
if (currentQuantity <= previousQuantity) {
|
||||
alert("Quantity must be greater than the previous row's quantity.");
|
||||
currentInput.value = previousQuantity + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextRow !== null) {
|
||||
var nextQuantityInput = nextRow.querySelector('input[name="quantity[]"]');
|
||||
var nextQuantity = parseInt(nextQuantityInput.value);
|
||||
|
||||
if (currentQuantity >= nextQuantity) {
|
||||
alert("Quantity must be less than the next row's quantity.");
|
||||
currentInput.value = nextQuantity - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkExistingQuantity(row) {
|
||||
var currentInput = row.querySelector('input[name="quantity[]"]');
|
||||
var allRows = document.querySelectorAll("#price-matrix-body tr");
|
||||
var currentIndex = Array.from(allRows).indexOf(row);
|
||||
|
||||
for (var i = currentIndex - 1; i >= 0; i--) {
|
||||
var previousRow = allRows[i];
|
||||
var previousQuantityInput = previousRow.querySelector('input[name="quantity[]"]');
|
||||
var currentQuantity = parseInt(currentInput.value);
|
||||
var previousQuantity = parseInt(previousQuantityInput.value);
|
||||
|
||||
if (currentQuantity <= previousQuantity) {
|
||||
alert("Quantity must be greater than the previous row's quantity.");
|
||||
currentInput.value = previousQuantity + 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var nextRow = allRows[currentIndex + 1];
|
||||
if (nextRow !== undefined) {
|
||||
var nextQuantityInput = nextRow.querySelector('input[name="quantity[]"]');
|
||||
var nextQuantity = parseInt(nextQuantityInput.value);
|
||||
|
||||
if (currentQuantity >= nextQuantity) {
|
||||
alert("Quantity must be less than the next row's quantity.");
|
||||
currentInput.value = nextQuantity - 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("price-matrix-body").addEventListener("blur", function(event) {
|
||||
if (event.target.tagName === "INPUT" && event.target.name === "quantity[]") {
|
||||
checkExistingQuantity(event.target.closest("tr"));
|
||||
}
|
||||
}, true);
|
||||
// 3-20-24 raymart added function for price matrix
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function onload() {
|
||||
variables();
|
||||
}
|
||||
|
||||
function variables() {
|
||||
var x = document.getElementById('Categories').value;
|
||||
var y = document.getElementById('variation');
|
||||
if (x != 'variation') {
|
||||
y.style.visibility = 'hidden';
|
||||
y.classList.add('collapse');
|
||||
} else {
|
||||
y.style.visibility = 'visible';
|
||||
y.classList.remove('collapse');
|
||||
}
|
||||
}
|
||||
|
||||
function uploadProductImage() {
|
||||
var productId = '<?php echo $_SESSION['productId'] ?>';
|
||||
var fileInput = document.getElementById('imageUpload');
|
||||
var files = fileInput.files;
|
||||
|
||||
if (files.length > 0) {
|
||||
var promises = [];
|
||||
var existingImages = [];
|
||||
|
||||
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId)
|
||||
.then(response => response.json())
|
||||
.then(product => {
|
||||
existingImages = product.images || [];
|
||||
existingImages = Array.isArray(existingImages) ? existingImages : [existingImages];
|
||||
existingImages = existingImages.filter(image => image);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching existing images:', error);
|
||||
});
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
const reader = new FileReader();
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
reader.onload = function(e) {
|
||||
const img = new Image();
|
||||
img.onload = function() {
|
||||
const canvas = document.createElement('canvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
const maxWidth = 1200;
|
||||
const maxHeight = 1000;
|
||||
const aspectRatio = img.width / img.height;
|
||||
let newWidth = img.width;
|
||||
let newHeight = img.height;
|
||||
|
||||
if (img.width > maxWidth) {
|
||||
newWidth = maxWidth;
|
||||
newHeight = newWidth / aspectRatio;
|
||||
}
|
||||
|
||||
if (newHeight > maxHeight) {
|
||||
newHeight = maxHeight;
|
||||
newWidth = newHeight * aspectRatio;
|
||||
}
|
||||
|
||||
canvas.width = newWidth;
|
||||
canvas.height = newHeight;
|
||||
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
||||
|
||||
canvas.toBlob((blob) => {
|
||||
const resizedFile = new File([blob], file.name, {
|
||||
type: 'image/jpeg'
|
||||
});
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('image_id', productId);
|
||||
formData.append('category', 'product');
|
||||
formData.append('image', resizedFile);
|
||||
|
||||
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
console.error('File upload failed');
|
||||
reject(new Error('File upload failed'));
|
||||
}
|
||||
})
|
||||
.then(result => {
|
||||
const filename = result.filename;
|
||||
resolve(filename);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during fetch:', error);
|
||||
reject(error);
|
||||
});
|
||||
}, 'image/jpeg');
|
||||
};
|
||||
|
||||
img.src = e.target.result;
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
|
||||
promises.push(promise);
|
||||
}
|
||||
// 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename
|
||||
Promise.all(promises)
|
||||
.then(filenames => {
|
||||
// const updatedImages = existingImages.concat(filenames.map(filename => `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${filename}`));
|
||||
const updatedImages = existingImages.concat(filenames.map(filename => `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/product_uploads/${encodeURIComponent(filename)}`));
|
||||
|
||||
if (!Array.isArray(updatedImages)) {
|
||||
console.error('Updated images is not an array:', updatedImages);
|
||||
throw new Error('Updated images is not an array');
|
||||
}
|
||||
const imagesString = updatedImages.join(',');
|
||||
const payload = {
|
||||
images: imagesString,
|
||||
};
|
||||
|
||||
const token = '<?php echo $_SESSION["token"] ?>';
|
||||
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/' + productId, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token,
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
})
|
||||
// 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Images uploaded successfully');
|
||||
location.reload();
|
||||
} else {
|
||||
console.error('Image upload failed');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during image upload:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Common Javascript -->
|
||||
<script src="assets/plugins/jquery/jquery-3.5.1.min.js"></script>
|
||||
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/plugins/tags-input/bootstrap-tagsinput.js"></script>
|
||||
<script src="assets/plugins/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/plugins/jquery-zoom/jquery.zoom.min.js"></script>
|
||||
<script src="assets/plugins/slick/slick.min.js"></script>
|
||||
|
||||
<!-- Option Switcher -->
|
||||
<script src="assets/plugins/options-sidebar/optionswitcher.js"></script>
|
||||
|
||||
<!-- Ekka Custom -->
|
||||
<script src="assets/js/ekka.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -785,7 +785,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
console.log("Session Token:", sessionToken);
|
||||
login(email, password, function() {
|
||||
// Removed the call to updateSessionToken
|
||||
window.open("product-edit.php?id=" + productId, "_self");
|
||||
window.open("vendor-edit-product.php?id=" + productId, "_self");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -131,29 +131,6 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
|
||||
<!-- Background css -->
|
||||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||||
<style>
|
||||
.pagination {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pagination a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ccc;
|
||||
margin: 0 5px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.pagination a.active {
|
||||
background-color: #007bff;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function updateCartItemCount() {
|
||||
$.get("cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data, status) {
|
||||
|
@ -329,7 +306,7 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
if (isset($vendor["vendor_image"])) {
|
||||
?><img src="<?php echo $vendor["vendor_image"] ?>" alt="vendor img"><?php
|
||||
} else {
|
||||
?><img src="assets/images/vendor/5.jpg" alt="vendor img"><?php
|
||||
?><img src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="vendor img"><?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
|
@ -417,11 +394,8 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<?php
|
||||
//var_dump($products);
|
||||
foreach ($filteredProducts as $product){
|
||||
|
||||
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
// $pid = $i;
|
||||
$vendorOfProduct = getVendorbyId($simpleProducts[$pid]['vendor_api_id']);
|
||||
?>
|
||||
$vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-6 mb-6 pro-gl-content">
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
|
@ -548,7 +522,6 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
</div>
|
||||
</div>
|
||||
<!-- Ec Pagination Start -->
|
||||
|
||||
<!-- <div class="ec-pro-pagination">
|
||||
<span>Showing 1-12 of 21 item(s)</span>
|
||||
<ul class="ec-pro-pagination-inner">
|
||||
|
@ -648,6 +621,65 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="ec-sidebar-block">
|
||||
<div class="ec-sb-title">
|
||||
<h3 class="ec-sidebar-title">Category</h3>
|
||||
</div>
|
||||
<div class="ec-sb-block-content">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" checked /> <a href="#">clothes</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">Bags</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">Shoes</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">cosmetics</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">electrics</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">phone</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li id="ec-more-toggle-content" style="padding: 0; display: none;">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">Watch</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" /> <a href="#">Cap</a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item ec-more-toggle">
|
||||
<span class="checked"></span><span id="ec-more-toggle">More
|
||||
Categories</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Sidebar Size Block -->
|
||||
<!-- <div class="ec-sidebar-block">
|
||||
<div class="ec-sb-title">
|
||||
|
|
|
@ -381,8 +381,8 @@ if (isset($_GET['id'])) {
|
|||
<?php
|
||||
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
|
||||
if (isset($product_details['sale_price']) && $product_details['sale_price'] > 0) {
|
||||
echo '<span id="productPrice" class="old-price">' . $product_details['regular_price'] . '</span>';
|
||||
echo '<span id="productNewPrice" class="new-price">' . $product_details['sale_price'] . '</span>';
|
||||
echo '<s><span id="productPrice" class="old-price">₱' . $product_details['regular_price'] . '</span></s>';
|
||||
echo '<span id="productNewPrice" class="new-price">₱' . $product_details['sale_price'] . '</span>';
|
||||
} elseif (!isset($product_details['regular_price']) || $product_details['regular_price'] <= 0) {
|
||||
echo '<span id="productPrice" class="new-price">Contact Seller for Price</span>';
|
||||
} else {
|
||||
|
@ -510,7 +510,7 @@ if (isset($_GET['id'])) {
|
|||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="wishlist()"><i class="fi fi-rr-heart" style="color:#B80F0A; font-size:20px;"></i></a>
|
||||
</div>';
|
||||
} else {
|
||||
echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
|
||||
echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#priceModal" style="text-wrap:nowrap;" >Contact seller</button>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue