diff --git a/admin/.gitignore b/admin/.gitignore
new file mode 100644
index 0000000..9b15ad2
--- /dev/null
+++ b/admin/.gitignore
@@ -0,0 +1,2 @@
+# ignore config.php
+config.php
diff --git a/admin/config.php b/admin/config.php
index 2c49fab..d51d6b8 100644
--- a/admin/config.php
+++ b/admin/config.php
@@ -1,8 +1,9 @@
+
+
+
+
+
+
+
+
+
@@ -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 = '
' +
+ ' | ' +
+ ' | ' +
+ ' | ' +
+ '
';
+ 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
+
- function renewToken(sessionToken, email, password, userId) {
- // Add your logic here to renew the login token
- login(email, password, sessionToken, function() {
- // Callback function after renewing the token, e.g., show the modal
- showTheModal(userId);
- });
- }
+
+
- function login(username, password, sessionToken, callback) {
- fetch("https:///api/v1/login", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- "X-Api-Key": "{{apiKey}}"
- },
- body: JSON.stringify({
- username: username,
- password: password
- })
- })
- .then(response => {
- if (response.ok) {
- return response.json();
- } else {
- throw new Error("Unable to login");
- }
- })
- .then(data => {
- // Update the session token on the server side
- fetch("update-token-session.php", {
- method: "POST",
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify({
- token: data.token
- })
- })
- .then(response => response.json())
- .then(result => {
- if (result.status === 'success') {
- // Update the session token in the client-side variable
- sessionToken = data.token;
- console.log("New Token:", sessionToken);
- callback();
- } else {
- throw new Error("Unable to update session token");
- }
- });
- })
- .catch(error => {
- console.error("Error:", error.message);
- });
- }
-
- function showTheModal(userId) {
- // Add your logic here to show the modal
- // You may need to trigger it manually if using Bootstrap modal
- $('#modalContact-' + userId).modal('show');
- }
-
-
-
-
-
-
diff --git a/admin/vendor-card.php b/admin/vendor-card.php
index 79fea72..f348835 100644
--- a/admin/vendor-card.php
+++ b/admin/vendor-card.php
@@ -80,564 +80,12 @@ $products = productList();
+
+
+
-
-
-
@@ -651,8 +99,16 @@ $products = productList();
-
+
+
+
+
No Vendor Found.';
+ }
// $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 '
![Avatar Image](' . $vendor['vendor_image'] . ')
';
} else {
- echo '
![Placeholder Image](assets/img/vendor/u1.jpg)
';
+ echo '
![Placeholder Image](https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png)
';
}
?>
@@ -694,15 +171,15 @@ $products = productList();
-
-
+
-
-
+
diff --git a/admin/vendor-edit-product-action.php b/admin/vendor-edit-product-action.php
new file mode 100644
index 0000000..b3a54c4
--- /dev/null
+++ b/admin/vendor-edit-product-action.php
@@ -0,0 +1,73 @@
+';
+$productName = $_POST['product_name'];
+//echo '$productName: '.$productName.'
';
+$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.'
';
+$price = $_POST['regular_price'];
+//echo '$price: '.$price.'
';
+$salePrice = $_POST['sale_price'];
+//echo '$salePrice: '.$salePrice.'
';
+$weight = $_POST['weight'];
+$length = $_POST['length'];
+$width = $_POST['width'];
+$height = $_POST['height'];
+$description = $_POST['product_description'];
+$specifications = $_POST['specifications'];
+//echo '$specifications: '.$specifications.'
';
+$productType = $_POST['product_type'];
+$productCategory = $_POST['product_category'];
+$productSf = $_POST['shipping_fee'];
+$productStatus = $_POST['status'];
+//echo '$productType: '.$productType.'
';
+$parentId = $_POST['parent_id'];
+//echo '$parentId: '.$parentId.'
';
+$size = $_POST['size'];
+//echo '$size: '.$size.'
';
+$color = $_POST['color'];
+//echo '$color: '.$color.'
';
+$material = $_POST['material'];
+//echo '$material: '.$material.'
';
+$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");
+?>
diff --git a/admin/vendor-edit-product.php b/admin/vendor-edit-product.php
new file mode 100644
index 0000000..44450b2
--- /dev/null
+++ b/admin/vendor-edit-product.php
@@ -0,0 +1,726 @@
+ "") {
+ $_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"];
+
+?>
+
+
+
+
+
+
+
+
+
+ oBanana B2B - Admin Dashboard
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![edit](<?php echo $first_image_url; ?>)
+
+
![edit](https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019)
+
+
+
+
+
+ $image_url) {
+ $image_url = trim($image_url);
+ ?>
+
+
+
+
+
+
+
![edit](<?php echo $image_url; ?>)
+
+
+
+
+
+
+
+
+
+
+
+
![edit](assets/images/product-image/vender-upload-thumb-preview.jpg)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/vendor-product-search.php b/admin/vendor-product-search.php
index b39152a..6395c78 100644
--- a/admin/vendor-product-search.php
+++ b/admin/vendor-product-search.php
@@ -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");
});
}
diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php
index f923609..2c2df12 100644
--- a/admin/vendor-profile.php
+++ b/admin/vendor-profile.php
@@ -2,30 +2,91 @@
include "../functions.php";
if(isset($_SESSION["vendorId"])){
- if(isset($_GET["id"])){
- $_SESSION["vendorId"]=$_GET["id"];
- }
+ if(isset($_GET["id"])){
+ $_SESSION["vendorId"]=$_GET["id"];
+ }
} else {
- if(isset($_GET["id"])){
- $_SESSION["vendorId"]=$_GET["id"];
- } else {
- header("location: vendor-card.php");
- }
+ if(isset($_GET["id"])){
+ $_SESSION["vendorId"]=$_GET["id"];
+ } else {
+ header("location: vendor-card.php");
+ }
}
+
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
+
+
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
- //$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
+
} else {
$_SESSION["isLoggedIn"] = false;
- header("location: login.php");
+ header("location: login.php");
}
+
if($_SESSION["user_type"]!="admin"){
- header("location: login.php?alert=Only admins allowed here!");
+ header("location: login.php?alert=Only admins allowed here!");
}
+
$vendor = getVendorbyId($_SESSION["vendorId"]);
$array = json_decode($vendor,true);
+
+$selectedBankAccount = null;
+foreach ($array['bank_acount_details'] as $bankAccount) {
+ if ($bankAccount['bank_payout']) {
+ $selectedBankAccount = $bankAccount;
+ break;
+ }
+}
+if ($selectedBankAccount === null && !empty($array['bank_acount_details'])) {
+ $selectedBankAccount = $array['bank_acount_details'][0];
+}
+$selectedBankAccountJSON = json_encode($selectedBankAccount);
+
+
+$shopOrders = getOrderbyVendorId($_SESSION["vendorId"]);
+$vendorOrderss = json_decode($shopOrders);
+if (is_array($vendorOrderss)) {
+ $vendorOrders = json_decode($shopOrders);
+} elseif (is_object($vendorOrderss) && property_exists($vendorOrderss, 'message')) {
+ $vendorOrders = [];
+} else {
+ echo "Unknown type or no 'message' property found.";
+}
+
+$allPayouts = getAllPayout($_SESSION["token"]);
+$vendorPayouts = json_decode($allPayouts,true);
+
+
+$filteredPayouts = [];
+foreach ($vendorPayouts as $payout) {
+ if ($payout['vendor_details'][0]['vendor_id'] == $_SESSION["vendorId"]) {
+ $filteredPayouts[] = $payout;
+ }
+}
+
+$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;
+}
+// $token = loginRenew($_SESSION["email"], $_SESSION["password"], $token);
+// $_SESSION["token"] = $token;
+
+
?>
+
@@ -128,6 +189,18 @@ $array = json_decode($vendor,true);
-
-
-
+
+
+
-
+
@@ -418,14 +483,21 @@ $array = json_decode($vendor,true);
+
- ₱1,230 |
- EastWest |
- **** **** 1234 |
- Jon-Jon Manaay |
- Oct 20, 2018 |
+ |
+ |
+ |
+ |
+ |
- Deposited
+
|
- |
-
-
-
- ₱2,340 |
- EastWest |
- **** **** 1234 |
- Jon-Jon Manaay |
- Oct 27, 2018 |
-
- Processing
- |
-
-
|
-
+
@@ -533,7 +579,7 @@ $array = json_decode($vendor,true);
-
+
@@ -909,6 +955,12 @@ $array = json_decode($vendor,true);
+
+
+
+
+
+
@@ -916,7 +968,23 @@ $array = json_decode($vendor,true);
-
diff --git a/catalog-single-vendor.php b/catalog-single-vendor.php
index b158760..d567c64 100644
--- a/catalog-single-vendor.php
+++ b/catalog-single-vendor.php
@@ -131,29 +131,6 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
-
+
+
-
Payout History
-
-
+ Payout History
+
+
Amount |
@@ -237,51 +297,46 @@ if ($_SESSION["userId"] <> "") {
-
+
$val) {
$vendorIdCheck = $val['vendor_details'][0]['vendor_id'];
- if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($val['status'] == "DEPOSITED")) {
- echo "";
- echo "" . $val['net_amount'] . " | ";
- if (empty($val['bank_information'][0]['bank_name']) == false) {
- echo "" . $val['bank_information'][0]['bank_name'] . " | ";
- // echo "" . $val['bank_information'][0]['account_number'] . " | ";
- } else {
- echo 'N/A | ';
- }
- if (empty($val['bank_information'][0]['bank_account_number']) == false) {
- echo "" . $val['bank_information'][0]['bank_account_number'] . " | ";
- // echo "" . $val['bank_information'][0]['account_number'] . " | ";
- } else {
- echo 'N/A | ';
- };
- echo "December 08, 2024 | ";
- echo "" . $val['status'] . " | ";
- echo "" .
- "" .
- " | ";
- echo "
";
+ $status = ucfirst(strtolower($val['status']));
+ $payoutDate = date("F d, Y", strtotime($val['createdAt']));
+ $payoutId = $val['_id'];
+ if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($status == "Deposited")) { ?>
+
+ |
+
+ |
+
+ N/A |
+
+ |
+
+ N/A |
+
+ |
+ |
+
+
+
+ |
+
+
-
+ } ?>
+
@@ -290,105 +345,27 @@ if ($_SESSION["userId"] <> "") {
-
+
+
+
-
-
-
-
-
-
-
Payout Information
-
-
-
-
-
-
Gross Amount
-
₱ 1,150.00
-
-
-
Fees, Deductions, Adjustments
-
-
-
- ₱ 35.00
-
-
-
Net Amount
-
- ₱ 1125.00
-
-
-
-
-
-
-
Bank Information
-
-
-
-
Account Name
-
Juan De La Cruz
-
-
-
Account Number
-
Ending in 6618
-
-
-
-
-
-
-
Transaction Logs
-
-
-
-
- Type |
- Transaction Date |
- Gross Amount |
- Fee |
- Net Amount |
- Description |
-
-
-
-
- Payment |
- December 1, 2020, 10:00 PM |
- ₱ 150.OO |
- - ₱ 5.00 |
- ₱ 145.00 |
- FOURFORTY - 175 |
-
-
-
-
-
-
+
+
+
@@ -622,15 +599,157 @@ if ($_SESSION["userId"] <> "") {
-
+
+
+
+
+
diff --git a/vendor-refund-history.php b/vendor-refund-history.php
index ac67554..a8fd9bb 100644
--- a/vendor-refund-history.php
+++ b/vendor-refund-history.php
@@ -57,6 +57,9 @@ if (is_array($vendorOrderss)) {
+
+
+
@@ -66,13 +69,92 @@ if (is_array($vendorOrderss)) {
+
+
+