From 7be0e0cfb744d23e273e848d4a15e751b716b471 Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Thu, 21 Mar 2024 09:04:09 +0800 Subject: [PATCH 01/24] admin payout --- admin/index.php | 2 +- admin/vendor-profile.php | 298 ++++++++++++++++++--------------------- 2 files changed, 135 insertions(+), 165 deletions(-) diff --git a/admin/index.php b/admin/index.php index df56492..63de68d 100644 --- a/admin/index.php +++ b/admin/index.php @@ -111,7 +111,7 @@ if($_SESSION["user_type"]!="admin"){ Setting diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php index 4ed7951..0b536b4 100644 --- a/admin/vendor-profile.php +++ b/admin/vendor-profile.php @@ -25,6 +25,28 @@ if($_SESSION["user_type"]!="admin"){ } $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."; +} ?> @@ -843,176 +865,124 @@ $array = json_decode($vendor,true); - - - ObananaPay - ₱230 - - Paid - - No - - Coach Swagger - - Oct 20, 2018 - - - - + - - ObananaPay - ₱550 - - Paid - - No - - Toddler Shoes, Gucci Watch - - Nov 15, 2018 - - - - - - - - ObananaPay - ₱325 - - Paid - - No - - Hat Black Suits - - Nov 18, 2018 - - - - - - - - PayMongo - ₱200 - - Paid - - No - - T100 Power Bank - - Nov 20, 2018 - - - - - - - - ObananaPay - ₱150 - - Paid - - Yes - - Vodka Milk Tea - - Dec 11, 2018 - - - - - - + if ($orderItems['payment']['status'] === 'PAID') { + foreach ($orderItems['items'] as $item) { + ?> + + + + + + + + + + + + + + + + + + -
- -
+
+ +
- + From a810ab6bed99facdc0a48fd8b4bfebaafe1535d4 Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 22 Mar 2024 09:07:08 +0800 Subject: [PATCH 02/24] added masking on back acc number --- vendor-payouts.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index 40cd2fd..970d1a4 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -243,7 +243,7 @@ if ($_SESSION["userId"] <> "") { $vendorIdCheck = $val['vendor_details'][0]['vendor_id']; if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($val['status'] == "DEPOSITED")) { echo ""; - echo "" . $val['net_amount'] . ""; + 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'] . ""; @@ -251,8 +251,11 @@ if ($_SESSION["userId"] <> "") { 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'] . ""; + $accNum = $val['bank_information'][0]['bank_account_number']; + // Replace characters with asterisks for all characters except the last three segments + $maskedAccNum = substr_replace($accNum, str_repeat('*', strlen($accNum) - 3), 0, -3); + echo "" . $maskedAccNum . ""; + // echo "" . $val['bank_information'][0]['bank_account_number'] . ""; } else { echo 'N/A'; }; From a16c916761e57e04aef02f3b2528a42be9a4395e Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 22 Mar 2024 09:23:48 +0800 Subject: [PATCH 03/24] slight changes on user tab --- vendor-user-tabs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor-user-tabs.php b/vendor-user-tabs.php index 8e77193..0f07c94 100644 --- a/vendor-user-tabs.php +++ b/vendor-user-tabs.php @@ -9,7 +9,7 @@ $current_page = basename($_SERVER['PHP_SELF']);
  • >Uploads
  • >Settings (edit)
  • >Vendor Refund History
  • -
  • >Payouts
  • +
  • >Payouts
  • From 098858fb38a89657640239fd01ce2bd839c19885 Mon Sep 17 00:00:00 2001 From: Erwin Galang Date: Fri, 22 Mar 2024 02:25:00 +0000 Subject: [PATCH 04/24] new file: admin/.gitignore --- admin/.gitignore | 2 ++ admin/config.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 admin/.gitignore 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..ae055ef 100644 --- a/admin/config.php +++ b/admin/config.php @@ -1,8 +1,8 @@ Date: Fri, 22 Mar 2024 10:40:44 +0800 Subject: [PATCH 05/24] changes on the data table format --- vendor-payouts.php | 67 +++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index 970d1a4..96f269b 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -241,47 +241,34 @@ 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) { - $accNum = $val['bank_information'][0]['bank_account_number']; - // Replace characters with asterisks for all characters except the last three segments - $maskedAccNum = substr_replace($accNum, str_repeat('*', strlen($accNum) - 3), 0, -3); - echo "" . $maskedAccNum . ""; - // echo "" . $val['bank_information'][0]['bank_account_number'] . ""; - } else { - echo 'N/A'; - }; - echo "December 08, 2024"; - echo "" . $val['status'] . ""; - echo "" . - "" . - ""; - echo ""; + if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($val['status'] == "DEPOSITED")) { ?> + + + + + + N/A + + + + N/A + + December 08, 2023 + + + + + + - + } ?> From ce9edf65938481c228c25f54d91f1226eede3fe4 Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 22 Mar 2024 14:10:51 +0800 Subject: [PATCH 06/24] added get payout by Id function --- functions.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/functions.php b/functions.php index ed25bb6..5748d5f 100644 --- a/functions.php +++ b/functions.php @@ -1858,3 +1858,27 @@ function getAllPayout($token) return $response; } + +function getPayoutById($id, $token) +{ + $curl = curl_init(); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/payouts/$id", + 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}}', + 'Content-Type: application/json', + 'Authorization: Bearer ' . $token + ), + )); + $response = curl_exec($curl); + curl_close($curl); + + return $response; +} From e30c1453e1d2e0c2279d3082011daed83c2165a1 Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Fri, 22 Mar 2024 14:18:39 +0800 Subject: [PATCH 07/24] admin payout --- admin/config.php | 3 +- admin/user-card.php | 330 +++++++++++++++++++-------------------- admin/vendor-profile.php | 279 +++++++++++++++++---------------- 3 files changed, 312 insertions(+), 300 deletions(-) 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 @@
    - - + for ($x = $start; $x <= $end && $x < $totalUsers; $x++) { + $user = $users[$x]; + ?> + + +
    - @@ -284,76 +289,115 @@ if (is_array($vendorOrderss)) { + selectedOrders.forEach(order => { + var orderId = order.orderId; + fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + "Authorization": "Bearer " + token, + }, + body: JSON.stringify({ + payout_status: { + payout_id: data._id, + status: "Processing" + } + }) + }) + .then(response => { + // if (!response.ok) { + // console.error(`Failed to update payout status for order ${orderId}`); + // } + if (!response.ok) { + console.error(`Failed to update payout status for order ${orderId}`); + } else { + location.reload(); + } + }) + .catch(error => { + console.error(`Error updating payout status for order ${orderId}:`, error); + }); + }); + }) + .catch(error => { + console.error('Error:', error); + }); + } + @@ -417,35 +461,6 @@ if (is_array($vendorOrderss)) { - - ₱2,340 - EastWest - **** **** 1234 - Jon-Jon Manaay - Oct 27, 2018 - - Processing - - - - - - From 1f3d5121920a68804af680773f027556cd2f9342 Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Fri, 22 Mar 2024 14:26:35 +0800 Subject: [PATCH 08/24] Resolved merge conflicts --- admin/.gitignore | 2 + functions.php | 121 +++++--- vendor-payments.php | 704 +++++++++++++++++++++++++++++++++++++++++++ vendor-payouts.php | 182 +++++++---- vendor-user-tabs.php | 4 +- 5 files changed, 910 insertions(+), 103 deletions(-) create mode 100644 admin/.gitignore create mode 100644 vendor-payments.php 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/functions.php b/functions.php index 3880700..ed25bb6 100644 --- a/functions.php +++ b/functions.php @@ -6,7 +6,7 @@ function simpleProducts($category) { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -32,7 +32,7 @@ function simpleProducts($category) function sddProducts() { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8', @@ -51,7 +51,7 @@ function sddProducts() curl_close($curl); $json = json_decode($response, true); $products = array_filter($json, function ($var) { - return ($var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'variable' ); + return ($var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'variable'); }); $products = array_values($products); return $products; @@ -90,7 +90,7 @@ function sddProducts() function searchProducts($query) { $query = str_replace(" ", "+", $query); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/search?q=$query"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -140,7 +140,7 @@ $result = searchProducts($query); function searchVendor($query) { $query = str_replace(" ", "+", $query); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$query"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/search?q=$query"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -202,7 +202,7 @@ $result = searchProducts($query); function getProduct($product) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/$product"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/$product"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -226,7 +226,7 @@ function productList() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -248,7 +248,7 @@ function productList() function productListVendor($vendorId) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/" . $vendorId; + $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', @@ -278,7 +278,7 @@ function getProductVariations($parent_id) { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -314,7 +314,7 @@ function register($username, $password) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/register", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/register", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -342,7 +342,7 @@ function login($username, $password) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/login", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/login", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -362,7 +362,7 @@ function login($username, $password) } function forgot_password($email) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $email = $_SESSION["test_email_rcpt"]; } $curl = curl_init(); @@ -372,7 +372,7 @@ function forgot_password($email) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/forgot-password", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/forgot-password", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -392,7 +392,7 @@ function forgot_password($email) function getCustomerbyLoginId($id) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/login_id/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/login_id/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -416,7 +416,7 @@ function getCustomerbyLoginId($id) function getCustomer($id) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -440,7 +440,7 @@ function getCustomer($id) function getVendorbyLoginId($id) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/login_id/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/login_id/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -464,7 +464,7 @@ function getVendorbyLoginId($id) function customerExists($email) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/search?q=$email"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/search?q=$email"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, @@ -492,7 +492,7 @@ function customerExists($email) function vendorExists($email) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$email"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/search?q=$email"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, @@ -520,7 +520,7 @@ function vendorExists($email) function sendEmail_obanana($fName, $lName, $email, $phone, $message) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $email = $_SESSION["test_email_rcpt"]; } $salesEmail = $_SESSION["sales_email"]; @@ -639,7 +639,7 @@ function sendEmail_customer($fName, $lName, $email) function contact_Seller($cstm_email, $prd_name, $prd_qnty, $message) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $cstm_email = $_SESSION["test_email_rcpt"]; } $salesEmail = $_SESSION["sales_email"]; @@ -699,7 +699,7 @@ function contact_Seller($cstm_email, $prd_name, $prd_qnty, $message) function contact_Inquirer($cstm_email) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $cstm_email = $_SESSION["test_email_rcpt"]; } $msgto_inquirer = " @@ -760,7 +760,7 @@ function contact_Inquirer($cstm_email) function sendOTP($email) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $email = $_SESSION["test_email_rcpt"]; } $curl = curl_init(); @@ -836,7 +836,7 @@ function createCustomer($email, $phone, $firstname, $lastname, $loginId, $token) curl_setopt($curl, CURLOPT_POSTFIELDS, $array); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/customers", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -855,7 +855,7 @@ function createCustomer($email, $phone, $firstname, $lastname, $loginId, $token) function updateCustomer($customerId, $phone, $firstname, $lastname, $loginId, $token) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$customerId"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/$customerId"; $array = '{ "last_name": "' . $lastname . '", "login_id": "' . $loginId . '", @@ -892,7 +892,7 @@ function profile($token) $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/profile", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/profile", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -967,7 +967,7 @@ function profile($token) // } function updateVendor($vendorId, $phone, $userlogin, $firstname, $lastname, $loginId, $token) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$vendorId"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/$vendorId"; $array = '{ "login_id": "' . $loginId . '", "user_login": "' . $userlogin . '", @@ -1010,7 +1010,7 @@ function createVendor($email, $phone, $userlogin, $firstname, $lastname, $loginI ); curl_setopt($curl, CURLOPT_POSTFIELDS, $array); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1105,7 +1105,7 @@ function vendorList() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1128,7 +1128,7 @@ function simpleVendors() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1157,7 +1157,7 @@ function productListVendors($vendorIds) $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products?vendor_ids=" . $vendorIdsString, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products?vendor_ids=" . $vendorIdsString, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1180,7 +1180,7 @@ function simpleVendorsWithProducts() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1243,7 +1243,7 @@ function simpleVendorsWithProducts() function getVendorbyId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1267,7 +1267,7 @@ function getVendorbyId($id) function searchVendorByLoginId($id) { $id = str_replace(" ", "+", $id); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/search?q=$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1289,7 +1289,7 @@ function searchVendorByLoginId($id) function getOrder($order) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/$order"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/$order"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1313,7 +1313,7 @@ function getAllOrder() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/orders", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1341,7 +1341,7 @@ function getAllOrder() function getOrderbyCustomerId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/customer/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/customer/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1363,7 +1363,7 @@ function getOrderbyCustomerId($id) } function getOrderbyVendorId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/vendor/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/vendor/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1399,11 +1399,10 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co // $data['tracking_number'] = $trackingNumber; $data['payment']['status'] = $paymentStatus; $data['payment']['reference_number'] = $paymentReference; - } $params3 = json_encode($data); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/orders/" . $orderId, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/" . $orderId, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1454,7 +1453,7 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co function deleteOrderbyId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1508,7 +1507,7 @@ function addProduct( ); curl_setopt($curl, CURLOPT_POSTFIELDS, $array); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1573,9 +1572,9 @@ function editProduct( 'shipping_fee' => $productSf, 'status' => $productStatus, 'promo' => array( - 'next-day-delivery' => $ndd , - 'same-day-delivery' => $sdd , - 'free-shipping' => $freeSf + 'next-day-delivery' => $ndd, + 'same-day-delivery' => $sdd, + 'free-shipping' => $freeSf ), 'price_matrix' => array( $priceMatrix @@ -1618,7 +1617,7 @@ function editProduct( $params3 = json_encode($data); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/" . $productId, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/" . $productId, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1721,7 +1720,7 @@ function addVendor( $params2 = json_encode($data); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1746,7 +1745,7 @@ function addVendor( function getUsers() { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/users"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/users"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -1813,7 +1812,7 @@ function editUsers($id, $username, $userType, $token) $jsonPayload = json_encode($data); // Convert the array to JSON format curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users/" . $id, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/users/" . $id, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1834,4 +1833,28 @@ function editUsers($id, $username, $userType, $token) echo $response; return $response; -} \ No newline at end of file +} + +function getAllPayout($token) +{ + $curl = curl_init(); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/payouts", + 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}}', + 'Content-Type: application/json', + 'Authorization: Bearer ' . $token + ), + )); + $response = curl_exec($curl); + curl_close($curl); + + return $response; +} diff --git a/vendor-payments.php b/vendor-payments.php new file mode 100644 index 0000000..be9c8ae --- /dev/null +++ b/vendor-payments.php @@ -0,0 +1,704 @@ + "") { + $_SESSION["isLoggedIn"] = true; + $vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]); + $vendorLoginIdjson = json_decode($vendorLoginId, true); + if (isset($vendorLoginIdjson['results'][0])) { + $vendorData = $vendorLoginIdjson['results'][0]; + $vendorId = $vendorData['_id']; + $_SESSION["LoggedInVendorId"] = $vendorId; + } +} else { + $_SESSION["isLoggedIn"] = false; + header("location: login.php"); +} +$products = productList(); +$shopOrders = getOrderbyVendorId($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."; +} +?> + + + + + + + + + oBanana B2B - Elevate Your Business + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + +
    +
    +
    +
    +
    +
    +

    User History

    +
    +
    + +
      +
    • Home
    • +
    • History
    • +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    + 3 +
    +
    + +
    +
    + 4 +
    +
    + +
    + +
    +
    +
    + + + + + + + + + + + + + + + + +
    +
    +
    +

    Features

    +
    + + icon + +
    +
    +

    Color Scheme

    +
      +
    • +
    • +
    • +
    • +
    • +
    +
    +
    +

    Backgrounds

    + +
    +
    +

    Full Screen mode

    +
    +
    +
    Mode
    +
    On
    +
    Off
    +
    +
    +
    +
    +

    Dark mode

    +
    +
    +
    Mode
    +
    On
    +
    Off
    +
    +
    +
    +
    +

    RTL mode

    +
    +
    +
    Rtl
    +
    On
    +
    Off
    +
    +
    +
    +
    +

    Clear local storage

    + Clear Cache & Default +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor-payouts.php b/vendor-payouts.php index 53bf663..970d1a4 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -6,7 +6,6 @@ if ($_SESSION["userId"] <> "") { // $customer_data = getCustomerbyLoginId($_SESSION["userId"]); $vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]); $vendorLoginIdjson = json_decode($vendorLoginId, true); - // var_dump( $vendorLoginIdjson); if (isset($vendorLoginIdjson['results'][0])) { $vendorData = $vendorLoginIdjson['results'][0]; $vendorId = $vendorData['_id']; @@ -16,7 +15,8 @@ if ($_SESSION["userId"] <> "") { // // var_dump($vendor); // $array = json_decode($vendor,true); // var_dump($array); - + $response = getAllPayout($_SESSION['token']); + $vendorPayoutData = json_decode($response, true); } else { $_SESSION["isLoggedIn"] = false; header("location: login.php"); @@ -24,17 +24,6 @@ if ($_SESSION["userId"] <> "") { ?> - @@ -249,14 +238,50 @@ if ($_SESSION["userId"] <> "") { - ₱ 1,165.65 - EastWest Bank - ****6618 - December 08, 2023 - Deposited - - Details - + $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) { + $accNum = $val['bank_information'][0]['bank_account_number']; + // Replace characters with asterisks for all characters except the last three segments + $maskedAccNum = substr_replace($accNum, str_repeat('*', strlen($accNum) - 3), 0, -3); + echo "" . $maskedAccNum . ""; + // echo "" . $val['bank_information'][0]['bank_account_number'] . ""; + } else { + echo 'N/A'; + }; + echo "December 08, 2024"; + echo "" . $val['status'] . ""; + echo "" . + "" . + ""; + echo ""; + } + } + ?> + @@ -268,48 +293,94 @@ if ($_SESSION["userId"] <> "") { - - + --> @@ -612,14 +628,129 @@ if ($_SESSION["userId"] <> "") { - --> + + From 8eb07ad94f63c142fa7a718a634f61825a58624e Mon Sep 17 00:00:00 2001 From: jouls Date: Sat, 23 Mar 2024 12:01:46 +0800 Subject: [PATCH 10/24] added bankNum masking in modal box --- vendor-payouts.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index e1780a8..b5a372e 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -284,6 +284,7 @@ if ($_SESSION["userId"] <> "") { + @@ -704,6 +724,56 @@ $vendorPayoutData = json_decode($response, true); }); }); + From c3523bfddc86621ca2b03583189310362cdfbc39 Mon Sep 17 00:00:00 2001 From: jouls Date: Tue, 26 Mar 2024 13:53:58 +0800 Subject: [PATCH 16/24] Added Data Table Responsiveness --- vendor-payouts.php | 68 ++++++++-------------------------------------- 1 file changed, 12 insertions(+), 56 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index bc8ff57..2256f05 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -72,6 +72,9 @@ $vendorPayoutData = json_decode($response, true); + + + @@ -263,8 +266,8 @@ $vendorPayoutData = json_decode($response, true);
    Payout History
    -
    - +
    +
    @@ -276,16 +279,14 @@ $vendorPayoutData = json_decode($response, true); - + $val) { $vendorIdCheck = $val['vendor_details'][0]['vendor_id']; $status = ucfirst(strtolower($val['status'])); $payoutDate = date("F d, Y", strtotime($val['createdAt'])); $payoutId = $val['_id']; - if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($status == "Deposited")) { - $payoutsCount++; ?> + if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($status == "Deposited")) { ?> + + -
    + +
    All Order History
    @@ -236,20 +264,49 @@ if ($_SESSION["userId"] <> "") { Shop Now
    + +
    +
    +
    + +
    All Orders +
    +
    To Pay +
    +
    To Ship +
    +
    To Receive +
    +
    Complete +
    +
    +
    +
    + + + +
    - -
    +
    Amount
    - + @@ -288,6 +345,7 @@ if ($_SESSION["userId"] <> "") { // echo 'product'; // } ?> + product @@ -525,6 +583,9 @@ if ($_SESSION["userId"] <> "") { $totalAmount += $order['total_amount']; ?> + @@ -751,7 +812,6 @@ if ($_SESSION["userId"] <> "") {
    Image Name
    product
    - + +
    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)) { + + +
    From 3219755a31caf12cb7ee787474f5eea506cc37db Mon Sep 17 00:00:00 2001 From: Stacy Date: Tue, 26 Mar 2024 15:52:38 +0800 Subject: [PATCH 19/24] Modified product image preview --- index.php | 30 +++++++++++++++--------------- shop-list-left-sidebar.php | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/index.php b/index.php index c951910..a57d7ac 100644 --- a/index.php +++ b/index.php @@ -224,9 +224,9 @@ if ($_SESSION["userId"] <> "") { $vendorOfProduct = getVendorbyId($forAll[$pid]['vendor_api_id']); ?>
    -
    +
    -
    +
    "> @@ -237,7 +237,7 @@ if ($_SESSION["userId"] <> "") { if (!empty($image_urls)) { $first_image_url = trim($image_urls[0]); ?> - edit + edit "") { $vendorOfProduct = getVendorbyId($electronics[$pid]['vendor_api_id']); ?>
    -
    +
    -
    +
    "> @@ -357,7 +357,7 @@ if ($_SESSION["userId"] <> "") { if (!empty($image_urls)) { $first_image_url = trim($image_urls[0]); ?> - edit + edit "") { $vendorOfProduct = getVendorbyId($smartHome[$pid]['vendor_api_id']); ?>
    -
    +
    -
    +
    "> @@ -479,7 +479,7 @@ if ($_SESSION["userId"] <> "") { if (!empty($image_urls)) { $first_image_url = trim($image_urls[0]); ?> - edit + edit "") { $vendorOfProduct = getVendorbyId($forVehicle[$pid]['vendor_api_id']); ?>
    -
    +
    -
    +
    "> @@ -599,7 +599,7 @@ if ($_SESSION["userId"] <> "") { if (!empty($image_urls)) { $first_image_url = trim($image_urls[0]); ?> - edit + edit "") { $vendorOfProduct = getVendorbyId($newArrival[$pid]['vendor_api_id']); ?>
    -
    +
    -
    +
    "> @@ -1224,7 +1224,7 @@ if ($_SESSION["userId"] <> "") { if (!empty($image_urls)) { $first_image_url = trim($image_urls[0]); ?> - edit + edit - edit + edit From 951859d61049bdc0d13b6fc77ca51cd5cb0b7b1e Mon Sep 17 00:00:00 2001 From: Stacy Date: Tue, 26 Mar 2024 15:53:32 +0800 Subject: [PATCH 20/24] Shows customer email in the email field of register customer --- register_customer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/register_customer.php b/register_customer.php index 186462c..e518d27 100644 --- a/register_customer.php +++ b/register_customer.php @@ -1,5 +1,9 @@ From c4f30aa999b8a1ca53ffa02dc9752dce3233fb72 Mon Sep 17 00:00:00 2001 From: raymart Date: Tue, 26 Mar 2024 16:21:14 +0800 Subject: [PATCH 21/24] add price matrix and function for edit & delete --- admin/header.php | 16 +- admin/product-edit-action.php | 1 + admin/product-edit.php | 122 +++++ admin/vendor-edit-product-action.php | 73 +++ admin/vendor-edit-product.php | 726 +++++++++++++++++++++++++++ admin/vendor-product-search.php | 2 +- 6 files changed, 931 insertions(+), 9 deletions(-) create mode 100644 admin/vendor-edit-product-action.php create mode 100644 admin/vendor-edit-product.php diff --git a/admin/header.php b/admin/header.php index 020fd67..49e0e23 100644 --- a/admin/header.php +++ b/admin/header.php @@ -9,14 +9,14 @@
    -
    -
    - - -
    -
    +
    +
    + + +
    +
      diff --git a/admin/product-edit-action.php b/admin/product-edit-action.php index 62baaaf..09f9440 100644 --- a/admin/product-edit-action.php +++ b/admin/product-edit-action.php @@ -65,6 +65,7 @@ $response = editProduct( $color, $material, $size, + $priceMatrix, $token); $array = json_decode($response, true); $_SESSION['prodictId'] = $array['_id']; diff --git a/admin/product-edit.php b/admin/product-edit.php index 81cfeb2..1b25475 100644 --- a/admin/product-edit.php +++ b/admin/product-edit.php @@ -907,6 +907,33 @@ $vendorId = $_SESSION["vendorId"]; )
      + + +
      + + + + + + + + + + + $pair) : ?> + + + + + + + + +
      QuantityPrice (PHP)
      + +
      + +
      @@ -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 + +
      +
      +
      +
      +
      +
      +
      +
      +
      + + +
      +
      + + +
      +
      +
      +
      + + + +
      +
      + + + +
      +
      + + +
      +
      + + +
      +
      +
      +
      + +
      + +
      +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + + + +
      +
      + + +
      +
      +
      + + +
      +
      + + +
      + + +
      + + + + + + + + + + + $pair) : ?> + + + + + + + + +
      QuantityPrice (PHP)
      + +
      + + + +
      + +
      +
      +
      + style="background-color: blue;"> + +
      +
      +
      +
      + style="background-color: blue;"> + +
      +
      +
      +
      + style="background-color: blue;"> + +
      +
      +
      +
      + +
      + + +
      +
      + + +
      +
      + + +
      +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + \ 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"); }); } From 844ef1ff6f9a427173323046a48febeeb5c21a45 Mon Sep 17 00:00:00 2001 From: jouls Date: Tue, 26 Mar 2024 16:21:36 +0800 Subject: [PATCH 22/24] Added Dynamic Upcoming Payout Amount --- vendor-payouts.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index 571c307..5b84f9c 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -187,8 +187,25 @@ $vendorPayoutData = json_decode($response, true);

      + $val) { + $paymentStatus = strtolower($val['payment']['status']); + $orderStatus = $val['status']; + $payoutStatus = empty($val['payout_status']); + if(( $paymentStatus == "paid") && ( $orderStatus == "COMPLETED") && ($payoutStatus == true)){ + $orderAmount = $val['total_amount']; + $payoutSum += $orderAmount; + } + } + + $finalPayoutSum = number_format($payoutSum, 2, '.', ','); + ?> - ₱ 0.00 + ₱

      @@ -199,7 +216,8 @@ $vendorPayoutData = json_decode($response, true); Receive Payout on or before: Wed, Mar 20, 2024
      -->
      - Date: Tue, 26 Mar 2024 16:22:35 +0800 Subject: [PATCH 23/24] search bar for vendor name --- admin/vendor-card.php | 597 +++--------------------------------------- 1 file changed, 37 insertions(+), 560 deletions(-) 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 '; } else { - echo 'Placeholder Image'; + echo 'Placeholder Image'; } ?>
      @@ -694,15 +171,15 @@ $products = productList();
      • - +
      • - + From 342edfe2a0d74f107c347bf7acbddf39373aff9d Mon Sep 17 00:00:00 2001 From: raymart Date: Tue, 26 Mar 2024 16:24:48 +0800 Subject: [PATCH 24/24] minor changes for catalog and product --- catalog-single-vendor.php | 92 ++++++++++++++++++++++++++------------- product-left-sidebar.php | 6 +-- 2 files changed, 65 insertions(+), 33 deletions(-) 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 -