Compare commits
32 Commits
e3a95b604e
...
d15427e671
Author | SHA1 | Date |
---|---|---|
raymart | d15427e671 | |
MarkHipe | ec737139fa | |
Jun Barroga | 2ba801d77d | |
MarkHipe | 26653ef372 | |
Jun Barroga | a0289a997a | |
Jun Barroga | 2f599791df | |
MarkHipe | b978919ccb | |
gelonspr | d02aa49f3c | |
MarkHipe | 868fe51be8 | |
jouls | 82801fed8a | |
jouls | d24c4f98d2 | |
MarkHipe | d27f546bba | |
gelonspr | 97c1fa7562 | |
MarkHipe | 533f64d4fe | |
jouls | c62160014f | |
MarkHipe | 142418da3c | |
Stacy | 47a7083a31 | |
Stacy | a475ceecba | |
Stacy | 181b602087 | |
MarkHipe | 5448ee0c5e | |
jouls | 3609c5eee6 | |
jouls | 9a39b1e116 | |
jouls | 0adfc24884 | |
jouls | 82d8191c53 | |
jouls | 7751fecf0c | |
jouls | cf866edd41 | |
jouls | 6feb68fde8 | |
jouls | c94863aa99 | |
jouls | c92635ca1c | |
jouls | f121a053ee | |
jouls | d8f5ed576c | |
jouls | 55affaa372 |
|
@ -190,7 +190,61 @@ if($_SESSION["user_type"]!="admin"){
|
|||
const array = new Array(productData)
|
||||
console.log(array)
|
||||
// const parseJs =JSON.parse(productData)
|
||||
function searchProduct(e){
|
||||
function searchProduct(e) {
|
||||
const searchInput = document.getElementById('searchProduct');
|
||||
const productWrap = document.getElementById('productWrap');
|
||||
|
||||
// Clear previous search results
|
||||
productWrap.innerHTML = '';
|
||||
|
||||
// Get search query and ensure it's lowercase
|
||||
const query = searchInput.value.trim().toLowerCase();
|
||||
|
||||
// Filter products based on search query
|
||||
const filteredProducts = array[0].filter(product => {
|
||||
return product.product_name.toLowerCase().includes(query);
|
||||
});
|
||||
|
||||
if (filteredProducts.length > 0) {
|
||||
// Display filtered products
|
||||
filteredProducts.forEach(prod => {
|
||||
const productImage = prod.images.split(',') ?? [];
|
||||
const image = productImage[0] ?
|
||||
`<img class="img-fluid" src="${productImage[0]}" alt="product image" style="object-fit: cover; width: 100%; height: 100%;" />` :
|
||||
`<img class="img-fluid rounded-circle" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="placeholder image" style="object-fit: cover; width: 100%; height: 100%;" />`;
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('col-lg-3', 'col-md-4', 'col-sm-6');
|
||||
card.innerHTML = `
|
||||
<div class="card-wrapper">
|
||||
<div class="card-container">
|
||||
<div class="card-top">
|
||||
<div class="image-container" style="height: 300px;">
|
||||
${image}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<h3>${prod.product_name}</h3>
|
||||
<p>₱${prod.regular_price}</p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-edit" onclick="editProduct('${prod._id}');"><i class="mdi mdi-circle-edit-outline"></i></div>
|
||||
<div class="card-preview"><i class="mdi mdi-eye-outline"></i></div>
|
||||
<div class="card-remove" onclick="deleteProduct('${prod._id}');"><i class="mdi mdi mdi-delete-outline"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
productWrap.appendChild(card);
|
||||
});
|
||||
} else {
|
||||
// Display message if no products found
|
||||
productWrap.innerHTML = `<p style="padding-top:10px; padding-left:20px;">No Product Found.</p>`;
|
||||
}
|
||||
}
|
||||
const search = document.getElementById('searchProduct');
|
||||
search.addEventListener("input", searchProduct);
|
||||
/* function searchProduct(e){
|
||||
const searchInput = document.getElementById('searchProduct')
|
||||
|
||||
let search = []
|
||||
|
@ -255,7 +309,7 @@ if($_SESSION["user_type"]!="admin"){
|
|||
// console.log(search)
|
||||
}
|
||||
const search = document.getElementById('searchProduct')
|
||||
search.addEventListener("input", searchProduct)
|
||||
search.addEventListener("input", searchProduct) */
|
||||
</script>
|
||||
<!-- 3-18-24 raymart add function for search bar -->
|
||||
<!-- <div class="row">
|
||||
|
|
|
@ -1249,6 +1249,29 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
let itemNames = [];
|
||||
submitButton.addEventListener('click', async function() {
|
||||
if (pay1RadioButton.checked) {
|
||||
const selectedFName = document.getElementById('selectedFName').innerText;
|
||||
const selectedLName = document.getElementById('selectedLName').innerText;
|
||||
const selectedContact = document.getElementById('selectedContact').innerText;
|
||||
const sBuilding = document.getElementById('sBuilding').innerText;
|
||||
const sStreet = document.getElementById('sStreet').innerText;
|
||||
const sCity = document.getElementById('sCity').innerText;
|
||||
const sBarangay = document.getElementById('sBarangay').innerText;
|
||||
const sProvince = document.getElementById('sProvince').innerText;
|
||||
const sCountry = document.getElementById('sCountry').innerText;
|
||||
if (
|
||||
selectedFName.trim() === "" ||
|
||||
selectedLName.trim() === "" ||
|
||||
selectedContact.trim() === "" ||
|
||||
sBuilding.trim() === "" ||
|
||||
sStreet.trim() === "" ||
|
||||
sCity.trim() === "" ||
|
||||
sBarangay.trim() === "" ||
|
||||
sProvince.trim() === "" ||
|
||||
sCountry.trim() === ""
|
||||
) {
|
||||
alert("Please select address.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
<?php foreach ($cartItems as $checkout) { ?>
|
||||
<?php foreach ($checkout['items'] as $item) { ?>
|
||||
|
@ -1348,16 +1371,24 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
const newArray = Object.values(ordersToUpdate)
|
||||
console.log(newArray)
|
||||
const refchar = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let uniqueRef = '';
|
||||
for (let i = 0; i < 8; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * refchar.length);
|
||||
uniqueRef += refchar.charAt(randomIndex);
|
||||
}
|
||||
// let uniqueRef = '';
|
||||
// for (let i = 0; i < 8; i++) {
|
||||
// const randomIndex = Math.floor(Math.random() * refchar.length);
|
||||
// uniqueRef += refchar.charAt(randomIndex);
|
||||
// }
|
||||
newArray.forEach(async (orderId) => {
|
||||
console.log(orderId)
|
||||
const token = '<?php echo $_SESSION["token"] ?>';
|
||||
const shippingfee = parseFloat(orderId.shipping_fee)
|
||||
const patchResponse = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId._id}`, {
|
||||
const orderPay2ProductId = orderId.items[0].product.product_id;
|
||||
const productPay2Response = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/products/${orderPay2ProductId}`);
|
||||
const productPay2Data = await productPay2Response.json();
|
||||
let freeShippingObPay = false;
|
||||
if (productPay2Data.promo && productPay2Data.promo.length > 0 && productPay2Data.promo[0]['free-shipping'] === 'Yes') {
|
||||
freeShippingObPay = true;
|
||||
}
|
||||
const shippingFeesPay2 = freeShippingObPay ? 0 : shippingfee;
|
||||
const patchResponse2 = await fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId._id}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({
|
||||
shipping_address: {
|
||||
|
@ -1386,7 +1417,8 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
status: "UNPAID",
|
||||
reference_number: result.attributes.reference_number,
|
||||
},
|
||||
total_amount: parseFloat(orderId.total_amount) + shippingfee,
|
||||
shipping_fee: shippingFeesPay2,
|
||||
total_amount: parseFloat(orderId.total_amount) + shippingFeesPay2,
|
||||
order_date: iso8601String,
|
||||
payment_method: "Obananapay",
|
||||
}),
|
||||
|
@ -1396,12 +1428,12 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
},
|
||||
});
|
||||
|
||||
if (!patchResponse.ok) {
|
||||
throw new Error(`Error updating payment status: ${patchResponse.status} ${patchResponse.statusText}`);
|
||||
if (!patchResponse2.ok) {
|
||||
throw new Error(`Error updating payment status: ${patchResponse2.status} ${patchResponse2.statusText}`);
|
||||
}
|
||||
})
|
||||
console.log("Payment Successfull")
|
||||
window.location.href = 'user-history.php';
|
||||
// window.location.href = 'user-history.php';
|
||||
// console.log( <?php echo $filteredIdsJSON; ?>);
|
||||
}
|
||||
window.location.href = result.attributes.checkout_url;
|
||||
|
@ -1492,6 +1524,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
},
|
||||
total_amount: parseFloat(orderId.total_amount) + shippingFees,
|
||||
status: "TO PAY",
|
||||
shipping_fee: shippingFees,
|
||||
order_date: iso8601String,
|
||||
payment_method: "Cash On Delivery",
|
||||
}),
|
||||
|
@ -2171,4 +2204,4 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -291,7 +291,7 @@
|
|||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
<div class="recent-purchase">
|
||||
<!-- <div class="recent-purchase">
|
||||
<img src="assets/images/product-image/1.jpg" alt="payment image">
|
||||
<div class="detail">
|
||||
<p>Someone in new just bought</p>
|
||||
|
@ -299,7 +299,7 @@
|
|||
<p>10 Minutes ago</p>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Recent Purchase Popup end -->
|
||||
|
||||
<!-- Cart Floating Button -->
|
||||
|
|
32
faq.php
32
faq.php
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
@ -168,23 +168,23 @@
|
|||
<div class="col-md-12 ec-cms-block ec-abcms-block text-center">
|
||||
<div class="ec-cms-block-inner">
|
||||
<h3 class="ec-cms-block-title">What is Obanana Corporation's B2B eCommerce platform?</h3>
|
||||
<p>Obanana Corporation's B2B eCommerce platform is an online marketplace designed to connect businesses worldwide, facilitating trade between buyers and sellers.</p>
|
||||
<p>Obanana Corporation's B2B eCommerce platform is an online marketplace designed to connect businesses worldwide, facilitating trade between buyers and sellers.</p><br>
|
||||
<h3 class="ec-cms-block-title">What kind of products can be found on the Obanana Corporation platform?</h3>
|
||||
<p>Our platform offers a diverse range of products across various industries, including but not limited to electronics, clothing, machinery, raw materials, and more, catering to the needs of businesses across different sectors.</p>
|
||||
<p>Our platform offers a diverse range of products across various industries, including but not limited to electronics, clothing, machinery, raw materials, and more, catering to the needs of businesses across different sectors.</p><br>
|
||||
<h3 class="ec-cms-block-title">How does the platform ensure the quality of products listed?</h3>
|
||||
<p>To ensure quality standards, we implement rigorous verification processes for both sellers and products. We encourage buyers to provide feedback and ratings based on their experience, fostering transparency and trust within our marketplace.</p>
|
||||
<p>To ensure quality standards, we implement rigorous verification processes for both sellers and products. We encourage buyers to provide feedback and ratings based on their experience, fostering transparency and trust within our marketplace.</p><br>
|
||||
<h3 class="ec-cms-block-title">What are the payment options available on the Obanana Corporation platform?</h3>
|
||||
<p>We offer a variety of secure payment options to accommodate the needs of our users, including bank transfers, credit/debit cards, and third-party payment gateways, ensuring smooth and secure transactions.</p>
|
||||
<p>We offer a variety of secure payment options to accommodate the needs of our users, including bank transfers, credit/debit cards, and third-party payment gateways, ensuring smooth and secure transactions.</p><br>
|
||||
<h3 class="ec-cms-block-title">Can buyers and sellers communicate directly on the platform?</h3>
|
||||
<p>Yes, our platform facilitates direct communication between buyers and sellers through messaging features and inquiry forms, allowing for seamless negotiation and collaboration.</p>
|
||||
<p>Yes, our platform facilitates direct communication between buyers and sellers through messaging features and inquiry forms, allowing for seamless negotiation and collaboration.</p><br>
|
||||
<h3 class="ec-cms-block-title">How does shipping and logistics work on the Obanana Corporation platform?</h3>
|
||||
<p>We provide comprehensive shipping and logistics solutions, including freight forwarding services and shipping partners, to ensure efficient and timely delivery of goods to buyers worldwide.</p>
|
||||
<p>We provide comprehensive shipping and logistics solutions, including freight forwarding services and shipping partners, to ensure efficient and timely delivery of goods to buyers worldwide.</p><br>
|
||||
<h3 class="ec-cms-block-title">Are there any minimum order requirements for purchasing on the platform?</h3>
|
||||
<p>Minimum order requirements may vary depending on the seller and product category. Buyers can find detailed information regarding minimum order quantities on product listings.</p>
|
||||
<p>Minimum order requirements may vary depending on the seller and product category. Buyers can find detailed information regarding minimum order quantities on product listings.</p><br>
|
||||
<h3 class="ec-cms-block-title">Does Obanana Corporation offer any trade assurance or buyer protection services?</h3>
|
||||
<p>Yes, we provide trade assurance services to protect buyers' interests, offering refunds or replacements for orders that do not meet agreed-upon quality standards or fail to arrive within specified delivery times.</p>
|
||||
<p>Yes, we provide trade assurance services to protect buyers' interests, offering refunds or replacements for orders that do not meet agreed-upon quality standards or fail to arrive within specified delivery times.</p><br>
|
||||
<h3 class="ec-cms-block-title">How does Obanana Corporation handle disputes between buyers and sellers?</h3>
|
||||
<p>In the event of disputes, our dedicated support team mediates and facilitates resolution through our dispute resolution process, ensuring fair outcomes for all parties involved.</p>
|
||||
<p>In the event of disputes, our dedicated support team mediates and facilitates resolution through our dispute resolution process, ensuring fair outcomes for all parties involved.</p><br>
|
||||
<h3 class="ec-cms-block-title">How can businesses join the Obanana Corporation platform as sellers?</h3>
|
||||
<p>Businesses interested in becoming sellers on our platform can apply for membership through our website, where they will undergo a verification process to ensure compliance with our standards and policies.</p>
|
||||
</div>
|
||||
|
@ -196,7 +196,7 @@
|
|||
</section>
|
||||
|
||||
<!-- ec testmonial Start -->
|
||||
<section class="section ec-test-section section-space-ptb-100 section-space-m" id="reviews">
|
||||
<!-- <section class="section ec-test-section section-space-ptb-100 section-space-m" id="reviews">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
|
@ -283,11 +283,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section> -->
|
||||
<!-- ec testmonial end -->
|
||||
|
||||
<!-- services Section Start -->
|
||||
<section class="section ec-services-section section-space-p" id="services">
|
||||
<!-- <section class="section ec-services-section section-space-p" id="services">
|
||||
<h2 class="d-none">Services</h2>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -337,7 +337,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section> -->
|
||||
<!--services Section End -->
|
||||
|
||||
<!-- Ec Instagram Start -->
|
||||
|
@ -450,7 +450,7 @@
|
|||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
<div class="recent-purchase">
|
||||
<!-- <div class="recent-purchase">
|
||||
<img src="assets/images/product-image/1.jpg" alt="payment image">
|
||||
<div class="detail">
|
||||
<p>Someone in new just bought</p>
|
||||
|
@ -458,7 +458,7 @@
|
|||
<p>10 Minutes ago</p>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Recent Purchase Popup end -->
|
||||
|
||||
<!-- Cart Floating Button -->
|
||||
|
|
|
@ -274,6 +274,35 @@ function productListVendor($vendorId)
|
|||
return $json; // Add this line to return the decoded JSON data
|
||||
}
|
||||
|
||||
function allProductListVendor($vendorId)
|
||||
{
|
||||
$curl = curl_init();
|
||||
$url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/vendor/" . $vendorId;
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt_array($curl, array(
|
||||
//CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'X-Api-Key: {{apiKey}}'
|
||||
),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
$json = json_decode($response, true);
|
||||
$products = array_filter($json, function ($var) {
|
||||
return ($var['product_type'] == '' || $var['product_type'] == 'simple' || $var['product_type'] == 'variable' || $var['product_type'] == 'variation');
|
||||
});
|
||||
$products = array_values($products);
|
||||
return $products;
|
||||
return $json; // Add this line to return the decoded JSON data
|
||||
}
|
||||
|
||||
function getProductVariations($parent_id)
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
|
|
@ -345,7 +345,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
?><?php
|
||||
if ($_SESSION["isVendor"]) {
|
||||
?>
|
||||
<li><a class="dropdown-item" href="vendor-settings.php">My Account</a></li>
|
||||
<li><a class="dropdown-item" href="vendor-dashboard.php">My Account</a></li>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
if ($result > 0) {
|
||||
$_SESSION["isVendor"] = true;
|
||||
}
|
||||
header("location: index.php");
|
||||
header("location: $url");
|
||||
} else {
|
||||
// $_SESSION["loginError"] = "Invalid email or password. Please try again.";
|
||||
header("location: login.php?error=1");
|
||||
|
|
|
@ -487,12 +487,13 @@ if (isset($_GET['id'])) {
|
|||
<div class="ec-single-cart" style="display:flex; flex-direction:row; width:80%; overflow:visible; text-align:center; align-items:center; ">
|
||||
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
|
||||
<?php
|
||||
$product_price = (!empty($product_details['sale_price'])) ? $product_details['sale_price'] : $product_details['regular_price'] ;
|
||||
if ($_SESSION["isLoggedIn"]) {
|
||||
if ($product_details['product_type'] === "variable") {
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>';
|
||||
echo '<input class="qty-inputs" style="width:110px; height:40px" type="number" name="ec_qtybtn" value="';
|
||||
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
|
||||
echo '" id="qty-input" />';
|
||||
echo '" id="qty-input" oninput="handleInput()" />';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div>';
|
||||
echo '<div style="display:flex; margin-left:45px;"><button type="button" class="btn btn-primary" id="contactSellerButton" style="background:#ffaa00; width:190px;" data-bs-toggle="modal" data-bs-target="#priceModal"><i class="fi-rr-envelope" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Contact Seller</button>';
|
||||
echo '<button class="btn btn-primary" id="addToCartButton" style="display:none">Add To Cart</button>';
|
||||
|
@ -504,7 +505,7 @@ if (isset($_GET['id'])) {
|
|||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>';
|
||||
echo '<input class="qty-inputs" style="width:100px; height:40px" type="number" name="ec_qtybtn" value="';
|
||||
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
|
||||
echo '" id="qty-input" />';
|
||||
echo '" id="qty-input" oninput="handleInput()" />';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div>';
|
||||
// echo '<div id="addToCartMessage" style="border:1px solid red;"></div>';
|
||||
echo '<div> <div id="addToCartMessage" style="padding-left:45px;"></div> <button class="btn btn-primary" id="addToCartButton" style="text-wrap:nowrap; background:#ffaa00; margin-left:55px;"><i class="fi-rr-shopping-bag" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Add To Cart</button></div>';
|
||||
|
@ -626,12 +627,120 @@ if (isset($_GET['id'])) {
|
|||
</div> -->
|
||||
</div>
|
||||
<script>
|
||||
function increment() {
|
||||
/* 04-18-24 raymart added functioning the quantity to handle if the product has price matrix */
|
||||
function handleInput(action) {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
qtyInput.value = parseInt(qtyInput.value) + 1;
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
var minimumOrder = <?php echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>;
|
||||
|
||||
/* default to quantity 1 if input is empty */
|
||||
if (!currentQuantity || isNaN(currentQuantity)) {
|
||||
currentQuantity = 1;
|
||||
}
|
||||
|
||||
/* default to minimum quantity if the product has minimun order */
|
||||
if (currentQuantity < minimumOrder) {
|
||||
currentQuantity = minimumOrder;
|
||||
console.log("The minimum order quantity is " + minimumOrder);
|
||||
}
|
||||
|
||||
/* Ensure the quantity never goes below 1 */
|
||||
if (action === 'increment') {
|
||||
currentQuantity += 1;
|
||||
} else if (action === 'decrement' && currentQuantity > 1) {
|
||||
currentQuantity -= 1;
|
||||
}
|
||||
currentQuantity = Math.max(currentQuantity, 1);
|
||||
|
||||
qtyInput.value = currentQuantity;
|
||||
|
||||
var handlePrice = document.getElementById('productNewPrice') || document.getElementById('productPrice');
|
||||
var product_price = '<?php echo $product_price; ?>';
|
||||
var priceMatrices = <?php echo (!empty($product_details['price_matrix'])) ? json_encode($product_details['price_matrix']) : "[]"; ?>;
|
||||
var foundPrice = false;
|
||||
|
||||
for (var m = 0; m < priceMatrices.length; m++) {
|
||||
var priceMatrix = priceMatrices[m];
|
||||
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
var matrixQuantity = parseFloat(priceMatrix[i].quantity);
|
||||
var nextMatrixQuantity = (i < priceMatrix.length - 1) ? parseFloat(priceMatrix[i + 1].quantity) : Infinity;
|
||||
|
||||
if (currentQuantity >= matrixQuantity && currentQuantity < nextMatrixQuantity) {
|
||||
var unitPrice = parseFloat(priceMatrix[i].price);
|
||||
handlePrice.innerText = unitPrice.toFixed(2).toString().replace(/\.00$/, '');
|
||||
foundPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundPrice) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundPrice) {
|
||||
// Handle when quantity exceeds the highest price matrix
|
||||
var lastMatrix = priceMatrices[priceMatrices.length - 1];
|
||||
var highestQuantity = parseFloat(lastMatrix[lastMatrix.length - 1].quantity);
|
||||
if (currentQuantity >= highestQuantity) {
|
||||
var highestPrice = parseFloat(lastMatrix[lastMatrix.length - 1].price);
|
||||
handlePrice.innerText = highestPrice.toFixed(2).replace(/\.00$/, '');
|
||||
foundPrice = true;
|
||||
}
|
||||
}
|
||||
// If original price is within the quantity range
|
||||
if (!foundPrice) {
|
||||
handlePrice.innerText = product_price;
|
||||
}
|
||||
}
|
||||
|
||||
function decrement() {
|
||||
function increment() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
currentQuantity++;
|
||||
qtyInput.value = currentQuantity;
|
||||
|
||||
var incrementPrice;
|
||||
if (document.getElementById('productNewPrice')) {
|
||||
incrementPrice = document.getElementById('productNewPrice');
|
||||
} else {
|
||||
incrementPrice = document.getElementById('productPrice');
|
||||
}
|
||||
// var productPrice = document.getElementById('productPrice');
|
||||
var product_price = '<?php echo $product_price; ?>';
|
||||
|
||||
var foundPrice = false;
|
||||
var priceMatrix = <?php echo (!empty($product_details['price_matrix'])) ? json_encode($product_details['price_matrix']) : "[]"; ?>;
|
||||
|
||||
/* to determine if regular price or price matrix but it depends to the quantity */
|
||||
if (priceMatrix.length > 0) {
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
for (var j = 0; j < priceMatrix[i].length; j++) {
|
||||
var matrixQuantity = parseFloat(priceMatrix[i][j].quantity);
|
||||
var nextMatrixQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity;
|
||||
|
||||
if (currentQuantity >= matrixQuantity && currentQuantity < nextMatrixQuantity) {
|
||||
var regularPrice = parseFloat(priceMatrix[i][j].price);
|
||||
var nextPrice = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].price) : product_price;
|
||||
var unitPrice = regularPrice;
|
||||
incrementPrice.innerText = parseFloat(unitPrice.toFixed(2)).toString(); // Convert to floating-point number and then to string
|
||||
foundPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundPrice) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* function increment() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
qtyInput.value = parseInt(qtyInput.value) + 1;
|
||||
} */
|
||||
|
||||
/* function decrement() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
|
||||
|
@ -646,7 +755,64 @@ if (isset($_GET['id'])) {
|
|||
qtyInput.value = currentQuantity - 1;
|
||||
}
|
||||
<?php endif; ?>
|
||||
} */
|
||||
|
||||
function decrement() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
var minimumOrder = <?php echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>;
|
||||
if (currentQuantity <= minimumOrder) {
|
||||
console.log("The minimum order quantity is " + minimumOrder);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentQuantity > 1) {
|
||||
currentQuantity--;
|
||||
} else {
|
||||
return; // Don't decrement further if quantity is already 1
|
||||
}
|
||||
qtyInput.value = currentQuantity;
|
||||
|
||||
var decrementPrice;
|
||||
if (document.getElementById('productNewPrice')) {
|
||||
decrementPrice = document.getElementById('productNewPrice');
|
||||
} else {
|
||||
decrementPrice = document.getElementById('productPrice');
|
||||
}
|
||||
// var productPrice = document.getElementById('productPrice');
|
||||
var product_price = '<?php echo $product_price; ?>';
|
||||
|
||||
var foundPrice = false;
|
||||
var priceMatrix = <?php echo (!empty($product_details['price_matrix'])) ? json_encode($product_details['price_matrix']) : "[]"; ?>;
|
||||
|
||||
/* to determine if regular price or price matrix but it depends to the quantity */
|
||||
if (priceMatrix.length > 0) {
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
for (var j = 0; j < priceMatrix[i].length; j++) {
|
||||
var matrixQuantity = parseFloat(priceMatrix[i][j].quantity);
|
||||
var nextMatrixQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity;
|
||||
|
||||
if (currentQuantity >= matrixQuantity && currentQuantity < nextMatrixQuantity) {
|
||||
var regularPrice = parseFloat(priceMatrix[i][j].price);
|
||||
var nextPrice = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].price) : product_price;
|
||||
var unitPrice = regularPrice;
|
||||
decrementPrice.innerText = parseFloat(unitPrice.toFixed(2)).toString(); /* Convert to floating-point number and then to string */
|
||||
foundPrice = true;
|
||||
break;
|
||||
} else if (currentQuantity < matrixQuantity) {
|
||||
/* If current quantity is less than the minimum in the price matrix, display the regular price */
|
||||
decrementPrice.innerText = parseFloat(product_price).toFixed(2).replace(/\.00$/, ''); /* Remove trailing .00 */
|
||||
foundPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundPrice) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 04-18-24 raymart added functioning the quantity to handle if the product has price matrix */
|
||||
|
||||
<?php
|
||||
|
||||
|
@ -772,7 +938,22 @@ if (isset($_GET['id'])) {
|
|||
if (parseInt(quantityValue) < minimumOrder) {
|
||||
quantityValue = minimumOrder;
|
||||
alert("The minimum order quantity is " + minimumOrder);
|
||||
}
|
||||
} /* else {
|
||||
if (priceMatrix.length > 0) {
|
||||
var selectedPrice = null;
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
if (parseInt(priceMatrix[i].quantity) === parseInt(quantityValue)) {
|
||||
selectedPrice = priceMatrix[i].price;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedPrice !== null) {
|
||||
document.getElementById("price-display").innerText = "Price: $" + selectedPrice;
|
||||
} else {
|
||||
document.getElementById("price-display").innerText = "Price not available for this quantity";
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
// April 3, 2024 Jun Jihad Apply Matrix
|
||||
var productPrice;
|
||||
|
|
108
user-history.php
108
user-history.php
|
@ -7,6 +7,11 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
|
||||
} else {
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
}
|
||||
|
||||
if ($_SESSION["isVendor"] == true) {
|
||||
header("location: vendor-dashboard.php");
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
@ -323,7 +328,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="allOrders" class=" tab-content active">
|
||||
<!-- Content for "all Orders" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="allOrdersTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -342,29 +347,21 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['status']) && isset($order['items'][0]['product'])) {
|
||||
if (isset($order['status']) && (strtoupper($order['status']) === 'TO PAY' || strtoupper($order['status']) === 'TO SHIP' || strtoupper($order['status']) === 'TO RECEIVE' || strtoupper($order['status']) === 'COMPLETED') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
$jsonorder = json_encode($order);
|
||||
?>
|
||||
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
|
||||
<td>
|
||||
<?php
|
||||
// if (isset($order['items'][0]['product']['product_image'])) {
|
||||
// echo '<img class="prod-img" src="' . $order['items'][0]['product']['product_image'] . '" alt="product"> ';
|
||||
// } else {
|
||||
// echo '<img class="prod-img" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="product">';
|
||||
// }
|
||||
?>
|
||||
<img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
</td>
|
||||
<!-- <img class="prod-img" src="<?php # echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td> -->
|
||||
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
|
||||
<td><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['quantity']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['price']; ?></span></td>
|
||||
|
@ -374,16 +371,31 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
<!-- <td><span class="tbl-btn"><a class="btn btn-lg btn-primary" href="#">View</a></span></td> -->
|
||||
</tr>
|
||||
|
||||
<?php } else { ?>
|
||||
<td> <img class="prod-img" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="product"> </td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
// if (empty($order['status'])) {
|
||||
// echo '<tr><p style="padding-top:30px; padding-left:20px;">No Purchased Order/s Yet.</p></tr>';
|
||||
// }
|
||||
}
|
||||
}
|
||||
// } else if (empty($order['status'])) {
|
||||
// echo '<p style="padding-top:30px; padding-left:20px;">No Purchased Order/s Yet.</p>';
|
||||
// }
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Order/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
allOrdersTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -391,7 +403,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toPay" class="tab-content">
|
||||
<!-- Content for "To Pay" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toPayTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -410,12 +422,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['status']) && (strtoupper($order['status']) === 'TO PAY') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -439,6 +453,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Pay Order/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toPayTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -446,7 +472,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toShip" class="tab-content">
|
||||
<!-- Content for "To Ship" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toShipTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -467,12 +493,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['status']) && (strtoupper($order['status']) === 'TO SHIP') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -496,6 +524,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Ship Order/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toShipTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -503,7 +543,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toReceive" class="tab-content">
|
||||
<!-- Content for "To Receive" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toReceiveTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -523,12 +563,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['status']) && (strtoupper($order['status']) === 'TO RECEIVE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -560,6 +602,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Receive Order/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toReceiveTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -567,7 +621,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="completed" class="tab-content">
|
||||
<!-- Content for "Completed" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="completedTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -587,12 +641,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['status']) && (strtoupper($order['status']) === 'COMPLETED') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
|
||||
?>
|
||||
|
@ -831,6 +887,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Completed Order/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
completedTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -9,7 +9,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
|
||||
} else {
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
}
|
||||
if ($_SESSION["isVendor"] == true) {
|
||||
header("location: vendor-dashboard.php");
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -513,7 +520,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
location.reload();
|
||||
// location.reload();
|
||||
// filter the delete action
|
||||
document.getElementById('form-check-' + addressIndex).remove();
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
|
||||
} else {
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
}
|
||||
|
||||
if ($_SESSION["isVendor"] == true) {
|
||||
header("location: vendor-dashboard.php");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -338,7 +345,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="allRefunds" class="tab-content active">
|
||||
<!-- Content for "all Orders" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="allRefundsTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -359,6 +366,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
|
@ -367,6 +375,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO APPROVE') || (strtoupper($order['return_order']['status']) === 'TO SHIP')
|
||||
|| (strtoupper($order['return_order']['status']) === 'TO RECEIVE') || (strtoupper($order['return_order']['status']) === 'TO REFUND')
|
||||
|| (strtoupper($order['return_order']['status']) === 'RETURN COMPLETE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -392,6 +401,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
allRefundsTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -399,7 +420,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toApprove" class="tab-content">
|
||||
<!-- Content for "To Approve" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toApproveTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -420,12 +441,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO APPROVE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -451,6 +474,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Approve Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toApproveTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -458,7 +493,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toShip" class="tab-content">
|
||||
<!-- Content for "To Ship" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toShipTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -479,12 +514,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO SHIP') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -510,6 +547,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Ship Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toShipTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -517,7 +566,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toReceive" class="tab-content">
|
||||
<!-- Content for "To Receive" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toReceiveTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -538,12 +587,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO RECEIVE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -572,6 +623,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Receive Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toReceiveTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -579,7 +642,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="toRefund" class="tab-content">
|
||||
<!-- Content for "To Refund" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toRefundTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -600,12 +663,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO REFUND') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -634,6 +699,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toRefundTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -641,7 +718,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div id="returnComplete" class="tab-content">
|
||||
<!-- Content for "Return Complete" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="returnCompleteTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -661,12 +738,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
$customer = $customer_data[0];
|
||||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'RETURN COMPLETE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -831,6 +910,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Completed Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
returnCompleteTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ $products = productList();
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$products = productListVendor($vendorId);
|
||||
$products = allProductListVendor($vendorId);
|
||||
$totalProducts = count($products);
|
||||
// 03-11-2024 Stacy added for products pagination
|
||||
$productsPerPage = 10;
|
||||
|
|
|
@ -28,6 +28,11 @@ if (is_array($vendorOrderss)) {
|
|||
echo "Unknown type or no 'message' property found.";
|
||||
}
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!--=========================================================
|
||||
Item Name: oBanana B2B - Elevate Your Business
|
||||
|
@ -265,7 +270,7 @@ if (is_array($vendorOrderss)) {
|
|||
}
|
||||
?> -->
|
||||
</td>
|
||||
<td><span><?php echo $item['product']['name']; ?></span></td>
|
||||
<td style="max-width:300px;"><span class="text-truncate"><?php echo $item['product']['name']; ?></span></td>
|
||||
<td><span><?php echo $orderItems['status']; ?></span></td>
|
||||
<td><span><?php echo $orderItems['shipping_address']['shipping_first_name']; ?></span></td>
|
||||
<td><span><?php echo $orderItems['total_amount']; ?></span></td>
|
||||
|
@ -463,7 +468,7 @@ if (is_array($vendorOrderss)) {
|
|||
}
|
||||
?> -->
|
||||
</td>
|
||||
<td><span><?php echo $product['product_name']; ?></span></td>
|
||||
<td style="max-width:300px;"><span class="text-truncate"><?php echo $product['product_name']; ?></span></td>
|
||||
<td><span><?php echo $product['regular_price']; ?></span></td>
|
||||
<td><span><?php echo $product['sale_price']; ?></span></td>
|
||||
<td><span><?php echo $product['minimum_order']; ?></span></td>
|
||||
|
|
|
@ -276,11 +276,28 @@ $products = productList();
|
|||
<!-- 03-11-2024 Stacy added pagination for vendor -->
|
||||
<!-- Ec Pagination Start -->
|
||||
<div class="pagination mt-3">
|
||||
<?php
|
||||
for ($i = 1; $i <= $totalPages; $i++) {
|
||||
echo "<a href='?page=$i' class='" . ($currentpage == $i ? 'active' : '') . "'>$i</a>";
|
||||
<?php
|
||||
$start = max(1, $currentpage - 2);
|
||||
$end = min($totalPages, $start + 4);
|
||||
|
||||
if ($start > 1) {
|
||||
echo "<a href='?page=1'>1</a>";
|
||||
if ($start > 2) {
|
||||
echo "<span> ... </span>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
for ($i = $start; $i <= $end; $i++) {
|
||||
echo "<a href='?page=$i' class='" . ($currentpage == $i ? 'active' : '') . "'>$i</a> ";
|
||||
}
|
||||
|
||||
if ($end < $totalPages) {
|
||||
if ($end < $totalPages - 1) {
|
||||
echo "<span> ... </span>";
|
||||
}
|
||||
echo "<a href='?page=$totalPages'>$totalPages</a>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<!-- Ec Pagination End -->
|
||||
</div>
|
||||
|
|
|
@ -30,6 +30,11 @@ if (is_array($vendorDecode)) {
|
|||
} else {
|
||||
echo "Unknown type or no 'message' property found.";
|
||||
}
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -81,6 +86,7 @@ if (is_array($vendorDecode)) {
|
|||
padding: 0;
|
||||
margin: 0;
|
||||
justify-content: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#pagination a {
|
||||
|
@ -479,6 +485,7 @@ if (is_array($vendorDecode)) {
|
|||
},
|
||||
success: function(response) {
|
||||
// Handle successful response
|
||||
console.log(response);
|
||||
var paymentId = response.payment.reference_number;
|
||||
$('#paymentIdSpan').text(paymentId);
|
||||
var gross_price = response.payment.details[0]?.attributes.data.attributes.amount;
|
||||
|
|
|
@ -8,7 +8,26 @@ if ($_SESSION["userId"] <> "") {
|
|||
header("location: login.php");
|
||||
}
|
||||
|
||||
// $customer_data = getCustomerbyLoginId($_SESSION["userId"]);
|
||||
if (isset($_SESSION["token"])) {
|
||||
$token = $_SESSION["token"];
|
||||
$token_parts = explode(".", $token);
|
||||
$token_payload = base64_decode($token_parts[1]);
|
||||
$token_data = json_decode($token_payload);
|
||||
|
||||
$issued_at_time = $token_data->iat;
|
||||
$expiration_time = $token_data->exp;
|
||||
$renewal_time = $issued_at_time + 3300;
|
||||
|
||||
if (time() >= $renewal_time || time() >= $expiration_time) {
|
||||
header("Location:vendor-payoutsTokenRN.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
$vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]);
|
||||
$vendorLoginIdjson = json_decode($vendorLoginId, true);
|
||||
if (isset($vendorLoginIdjson['results'][0])) {
|
||||
|
@ -17,24 +36,8 @@ if (isset($vendorLoginIdjson['results'][0])) {
|
|||
$_SESSION["LoggedInVendorId"] = $vendorId;
|
||||
}
|
||||
|
||||
$token = $_SESSION["token"];
|
||||
|
||||
$token_parts = explode(".", $token);
|
||||
$token_payload = base64_decode($token_parts[1]);
|
||||
$token_data = json_decode($token_payload);
|
||||
|
||||
$expiration_time = $token_data->exp;
|
||||
$issued_at_time = $token_data->iat;
|
||||
|
||||
$renewal_time = $issued_at_time + 3300;
|
||||
|
||||
|
||||
if (time() >= $renewal_time) {
|
||||
$token = loginRenew($_SESSION["email"], $_SESSION["password"], $token);
|
||||
$_SESSION["token"] = $token;
|
||||
}
|
||||
|
||||
$authToken = $_SESSION['token'];
|
||||
|
||||
$response = getAllPayout($authToken);
|
||||
$vendorPayoutData = json_decode($response, true);
|
||||
|
||||
|
@ -81,23 +84,6 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@latest/dist/css/select2.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@latest/dist/js/select2.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<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;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="shop_page">
|
||||
|
@ -155,19 +141,6 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<!-- Sidebar Category Block -->
|
||||
<div class="ec-sidebar-block">
|
||||
<div class="ec-vendor-block">
|
||||
<!-- <div class="ec-vendor-block-items">
|
||||
<ul>
|
||||
<li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a href="vendor-profile.html">Public Profile</a></li>
|
||||
<li><a href="vendor-uploads.html">Uploads</a></li>
|
||||
<li><a href="vendor-uploads.php">Uploads</a></li>
|
||||
<li><a href="#">Track Shipping</a></li>
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
|
||||
<li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a href="vendor-uploads-add-product-action.php">Upload Product</a></li>
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
|
||||
</ul>
|
||||
</div> -->
|
||||
<?php include "vendor-user-tabs.php" ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -269,12 +242,12 @@ $vendorPayoutData = json_decode($response, true);
|
|||
</strong>
|
||||
</div>
|
||||
</h4>
|
||||
<div class="text-sm mt-3">
|
||||
<!-- <div class="text-sm mt-3">
|
||||
Payout Generation: Tue, Mar 25, 2024
|
||||
</div>
|
||||
<div class="text-sm">
|
||||
Receive Payout on or before: Wed, Mar 26, 2024
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="text-sm">
|
||||
Receipient: Philippine National Bank (PNB) Account ending in <?php echo $bankNumEnding?>
|
||||
</div>
|
||||
|
@ -324,10 +297,7 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<td> <?php echo $payoutDate ?> </td>
|
||||
<td> <?php echo $status ?> </td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary showSinglePayoutBtn" data-order-id="<?php echo $payoutId; ?>" data-bs-toggle="modal" data-bs-target="#payoutsModal">View</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#payoutModal">
|
||||
Details
|
||||
</button> -->
|
||||
<button type="button" class="btn btn-primary btn-sm showSinglePayoutBtn" data-order-id="<?php echo $payoutId; ?>" data-bs-toggle="modal" data-bs-target="#payoutsModal">View</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -336,7 +306,6 @@ $vendorPayoutData = json_decode($response, true);
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id='pagination'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -379,14 +348,14 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<!-- raymart remove popup feb 20 2024 -->
|
||||
<!-- Recent Purchase Popup -->
|
||||
<!-- <div class=" recent-purchase">
|
||||
<img src="assets/images/product-image/1.jpg" alt="payment image">
|
||||
<div class="detail">
|
||||
<p>Someone in new just bought</p>
|
||||
<h6>stylish baby shoes</h6>
|
||||
<p>10 Minutes ago</p>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
|
||||
</div> -->
|
||||
<img src="assets/images/product-image/1.jpg" alt="payment image">
|
||||
<div class="detail">
|
||||
<p>Someone in new just bought</p>
|
||||
<h6>stylish baby shoes</h6>
|
||||
<p>10 Minutes ago</p>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
|
||||
</div> -->
|
||||
<!-- Recent Purchase Popup end -->
|
||||
|
||||
<!-- Cart Floating Button -->
|
||||
|
@ -637,30 +606,25 @@ $vendorPayoutData = json_decode($response, true);
|
|||
var bankNumEnding = bankNum.slice(-3); // Extract last three characters of bankNum
|
||||
var maskedBankNum = "Ending in " + bankNumEnding; // Create message
|
||||
var bankAccName = response.bank_information[0].bank_account_name;
|
||||
// var paymentType = response.transaction_logs[0].Type;
|
||||
// // var transDate = response.transaction_logs[0].Transaction + " " + date;
|
||||
// // var transGrossAmt = response.transaction_logs[0].Gross + " " + amount;
|
||||
// var transFee = response.transaction_logs[0].Fee;
|
||||
// // var transNetAmt = response.transaction_logs[0].Net + " " + amount;
|
||||
// var transDesc = response.transaction_logs[0].Description;
|
||||
var transactionLogsHtml = ''; // Initialize empty string to store HTML for transaction logs
|
||||
// Inside the success callback function
|
||||
var transactionLogsHtml = ''; // Initialize empty string to store HTML for transaction logs
|
||||
response.transaction_logs.forEach(function(log) {
|
||||
var paymentType = log.Type; // Assuming Transaction field holds the date
|
||||
var grossAmount = log.Gross; // Assuming Gross field holds the gross amount
|
||||
response.transaction_logs.forEach(function(log)
|
||||
{
|
||||
|
||||
var paymentType = log.Type;
|
||||
var transDate = log?.Transaction_date;
|
||||
var transGrossAmount = log?.Gross_Amount;
|
||||
var transFee = log.Fee;
|
||||
var netAmount = log.Net;
|
||||
var transNetAmount = log?.Net_Amount;
|
||||
var transDesc = log.Description;
|
||||
|
||||
// Append HTML for current transaction log to the transactionLogsHtml string
|
||||
transactionLogsHtml += `
|
||||
<tr>
|
||||
<td>${paymentType}</td>
|
||||
<td>Wala Muna</td>
|
||||
<td>₱ Wala muna</td>
|
||||
<td>${transDate}</td>
|
||||
<td>₱ ${transGrossAmount}</td>
|
||||
<td>- ₱ ${transFee}</td>
|
||||
<td>₱ Wala Muna</td>
|
||||
<td>₱ ${transNetAmount}</td>
|
||||
<td>${transDesc}</td>
|
||||
</tr>`;
|
||||
});
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
include "functions.php";
|
||||
|
||||
$token = loginRenew($_SESSION["email"], $_SESSION["password"], $_SESSION["token"]);
|
||||
$_SESSION["token"] = $token;
|
||||
|
||||
header("Location: vendor-payouts.php");
|
||||
exit;
|
||||
|
||||
?>
|
|
@ -27,6 +27,11 @@ if (is_array($vendorOrderss)) {
|
|||
} else {
|
||||
echo "Unknown type or no 'message' property found.";
|
||||
}
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -311,11 +316,12 @@ if (is_array($vendorOrderss)) {
|
|||
<div class="tab" data-tab-name="returnComplete" onclick="showTab('returnComplete')">Return Complete</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<!-- 03-26-2024 Stacy added tab for all orders -->
|
||||
<!-- Content for "All Refunds" tab -->
|
||||
<div id="allRefunds" class="tab-content active">
|
||||
<!-- Content for "All Refunds" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="allRefundTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -335,11 +341,13 @@ if (is_array($vendorOrderss)) {
|
|||
$order = $vendorOrders;
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
$orderExist = false; //for checking if order exist
|
||||
foreach ($orderItems as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO APPROVE') || (strtoupper($order['return_order']['status']) === 'TO SHIP')
|
||||
|| (strtoupper($order['return_order']['status']) === 'TO RECEIVE') || (strtoupper($order['return_order']['status']) === 'TO REFUND')
|
||||
|| (strtoupper($order['return_order']['status']) === 'RETURN COMPLETE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true; //if there's an order, orderExist will be set to true
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -361,16 +369,28 @@ if (is_array($vendorOrderss)) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
allRefundTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="toApprove" class="tab-content active">
|
||||
<!-- Content for "To Approve" tab -->
|
||||
|
||||
<!-- Content for "To Approve" tab -->
|
||||
<div id="toApprove" class="tab-content">
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toApproveTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -390,9 +410,11 @@ if (is_array($vendorOrderss)) {
|
|||
$order = $vendorOrders;
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
$orderExist = false;
|
||||
foreach ($orderItems as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO APPROVE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -418,16 +440,28 @@ if (is_array($vendorOrderss)) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Approve Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toApproveTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Content for "To Ship" tab -->
|
||||
<div id="toShip" class="tab-content">
|
||||
<!-- Content for "To Ship" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toShipTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -447,9 +481,11 @@ if (is_array($vendorOrderss)) {
|
|||
$order = $vendorOrders;
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
$orderExist = false;
|
||||
foreach ($orderItems as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO SHIP') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -471,16 +507,28 @@ if (is_array($vendorOrderss)) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Ship Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toShipTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Content for "To Receive" tab -->
|
||||
<div id="toReceive" class="tab-content">
|
||||
<!-- Content for "To Receive" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toReceiveTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -499,9 +547,11 @@ if (is_array($vendorOrderss)) {
|
|||
$order = $vendorOrders;
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
$orderExist = false;
|
||||
foreach ($orderItems as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO RECEIVE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -528,13 +578,26 @@ if (is_array($vendorOrderss)) {
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Receive Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toReceiveTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Content for "To Refund" tab -->
|
||||
<div id="toRefund" class="tab-content">
|
||||
<!-- Content for "To Refund" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="toRefundTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -553,9 +616,11 @@ if (is_array($vendorOrderss)) {
|
|||
$order = $vendorOrders;
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
$orderExist = false;
|
||||
foreach ($orderItems as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'TO REFUND') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -580,16 +645,28 @@ if (is_array($vendorOrderss)) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No To Refund/s Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
toRefundTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Content for "Return Complete" tab -->
|
||||
<div id="returnComplete" class="tab-content">
|
||||
<!-- Content for "Return Complete" tab -->
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<thead id="returnCompleteTHead">
|
||||
<tr class="Title">
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
|
@ -608,9 +685,11 @@ if (is_array($vendorOrderss)) {
|
|||
$order = $vendorOrders;
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
$orderExist = false;
|
||||
foreach ($orderItems as $order) {
|
||||
// Ensure that the required data is available before accessing it
|
||||
if (isset($order['return_order']['status']) && (strtoupper($order['return_order']['status']) === 'RETURN COMPLETE') && isset($order['items'][0]['product'])) {
|
||||
$orderExist = true;
|
||||
$totalAmount += $order['total_amount'];
|
||||
?>
|
||||
<?php
|
||||
|
@ -771,9 +850,20 @@ if (is_array($vendorOrderss)) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
if (!$orderExist) {
|
||||
echo '<p style="padding-top:30px; padding-left:20px;">No Refund/s Complete Yet.</p>';
|
||||
?>
|
||||
<script>
|
||||
returnCompleteTHead.style.display = 'none';
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="ec-vendor-detail-block ec-vendor-block-contact space-bottom-30">
|
||||
<h6>Contact nubmer</h6>
|
||||
<h6>Contact number</h6>
|
||||
<ul>
|
||||
<li style="padding:3%"><strong><?php echo $vendorData["phone"] ?></strong></li>
|
||||
</ul>
|
||||
|
@ -629,7 +629,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
<script>
|
||||
// function for deleting address
|
||||
const vendorid = `<?php echo $_SESSION["LoggedInVendorId"]; ?>`;
|
||||
// const vendorid = `<?php # echo $_SESSION["LoggedInVendorId"]; ?>`;
|
||||
function deleteAddress(vendorid, addressIndex) {
|
||||
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid)
|
||||
.then(response => response.json())
|
||||
|
@ -648,7 +648,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
location.reload();
|
||||
// location.reload();
|
||||
// filter the delete action
|
||||
document.getElementById('form-check-' + addressIndex).remove();
|
||||
} else {
|
||||
|
|
|
@ -20,6 +20,11 @@ if (isset($_GET['id'])) {
|
|||
}
|
||||
$result = getProduct($_SESSION['newProductId']);
|
||||
$array = json_decode($result, true);
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -419,7 +424,7 @@ $array = json_decode($result, true);
|
|||
</div>
|
||||
<!-- 03-15-2024 Jun Jihad price_matrix field Product Upload Vendor Page -->
|
||||
<!-- 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page -->
|
||||
<div class="col-md-12" style="margin: 0 0 20px 0;">
|
||||
<div class="col-md-12 pt-3" style="margin: 0 0 20px 0; white-space: nowrap;">
|
||||
<label class="form-label">Promo</label>
|
||||
<div class="row" justify-content-between>
|
||||
<div class="col-md-6">
|
||||
|
|
|
@ -13,6 +13,10 @@ if ($_SESSION["userId"] <> "") {
|
|||
} else {
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
}
|
||||
|
||||
if ($_SESSION["isVendor"] == true) {
|
||||
header("location: vendor-dashboard.php");
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -331,7 +335,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (xhr.status === 200) {
|
||||
// Product removed successfully, you can handle the UI update here if needed
|
||||
console.log('Product removed successfully');
|
||||
location.reload(); // Refresh the page after removing the product
|
||||
// location.reload(); // Refresh the page after removing the product
|
||||
} else {
|
||||
// Handle error response
|
||||
console.error('Error removing product:', xhr.responseText);
|
||||
|
@ -366,7 +370,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status === 200) {
|
||||
console.log('Products removed successfully');
|
||||
location.reload();
|
||||
// location.reload();
|
||||
} else {
|
||||
console.error('Error removing products:', xhr.responseText);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue