From 6d0170decff64add2f1110ba439f85ad8bd47084 Mon Sep 17 00:00:00 2001 From: jouls Date: Tue, 19 Mar 2024 17:15:54 +0800 Subject: [PATCH 01/15] added payout page and route --- vendor-payouts.php | 447 +++++++++++++++++++++++++++++++++++++++++++ vendor-user-tabs.php | 20 +- 2 files changed, 459 insertions(+), 8 deletions(-) create mode 100644 vendor-payouts.php diff --git a/vendor-payouts.php b/vendor-payouts.php new file mode 100644 index 0000000..6f8659e --- /dev/null +++ b/vendor-payouts.php @@ -0,0 +1,447 @@ + "") { + $_SESSION["isLoggedIn"] = true; + // $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']; + $_SESSION["LoggedInVendorId"] = $vendorId; + } + // $vendor= getVendorbyId($vendorLoginIdjson['results'][0]['_id']); + // // var_dump($vendor); + // $array = json_decode($vendor,true); + // var_dump($array); + +} else { + $_SESSION["isLoggedIn"] = false; + header("location: login.php"); +} +?> + + + + + + + + + oBanana B2B - Elevate Your Business + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + +
+
+
+
+
+
+

Vendor Settings

+
+
+ +
    +
  • Home
  • +
  • Settings
  • +
+ +
+
+
+
+
+
+ + + +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
+
+
+ +
+
+
+
Upcoming Payout
+
+
+ Panel content +
+
+
+
+
+
+
Payout Generation Schedule
+
+
+ Panel content +
+
+
+
+
+
+
Next Payout
+
+
+ Panel content +
+
+
+
+
Payout History
+ + + + + + + + + + + + + + + + + + + + +
AmountBankAccount NumberPayout GenerationStatusAction
PHP 1,165.65 EastWest Bank ****6618 December 08, 2023 Deposited + Details +
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + +
+ +
+
+ 3 +
+
+ + + +
+ + + + +
+
+
+ whatsapp icon +
+
+
+ +
+ + + +
+
+
+

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-user-tabs.php b/vendor-user-tabs.php index fc69951..8e77193 100644 --- a/vendor-user-tabs.php +++ b/vendor-user-tabs.php @@ -1,23 +1,27 @@ -
- \ No newline at end of file From 2289cce143cc6113d98541f30a69a1b5cda267e8 Mon Sep 17 00:00:00 2001 From: JunBarroga Date: Wed, 20 Mar 2024 08:12:40 +0800 Subject: [PATCH 02/15] modified: admin/vendor-profile.php --- admin/vendor-profile.php | 317 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 315 insertions(+), 2 deletions(-) diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php index 2553644..4ed7951 100644 --- a/admin/vendor-profile.php +++ b/admin/vendor-profile.php @@ -789,7 +789,17 @@ $array = json_decode($vendor,true);
-
+
+
+
+ +
+
+

Payments

+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MethodAmountStatusPayoutDescriptionDate
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 + +
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+

Payouts

+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AmountBankAccountNameDateStatus
₱1,230EastWest**** **** 1234Jon-Jon ManaayOct 20, 2018 + Deposited + + +
₱2,340EastWest**** **** 1234Jon-Jon ManaayOct 27, 2018 + Processing + + +
+
+
+
+
+
+
+ +
From 14609b96935180febfa6e91c4cd09dee838a55ab Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Wed, 20 Mar 2024 09:36:52 +0800 Subject: [PATCH 03/15] Bank Account --- admin/product-edit.php | 5 +- admin/vendor-card.php | 104 ++++---------- functions.php | 4 + user-history.php | 27 +++- vendor-settings.php | 186 +++++++++++++++++++++++++ vendor-uploads-edit-product-action.php | 13 ++ vendor-uploads.php | 162 ++++++++++++++++++--- 7 files changed, 395 insertions(+), 106 deletions(-) diff --git a/admin/product-edit.php b/admin/product-edit.php index 4ec941c..81cfeb2 100644 --- a/admin/product-edit.php +++ b/admin/product-edit.php @@ -1130,10 +1130,10 @@ $vendorId = $_SESSION["vendorId"]; promises.push(promise); } - + // 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename Promise.all(promises) .then(filenames => { - const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${filename}`)); + const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${encodeURIComponent(filename)}`)); if (!Array.isArray(updatedImages)) { console.error('Updated images is not an array:', updatedImages); @@ -1154,6 +1154,7 @@ $vendorId = $_SESSION["vendorId"]; body: JSON.stringify(payload) }); }) + // 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename .then(response => { if (response.ok) { console.log('Images uploaded successfully'); diff --git a/admin/vendor-card.php b/admin/vendor-card.php index d8ab00d..79fea72 100644 --- a/admin/vendor-card.php +++ b/admin/vendor-card.php @@ -4,7 +4,7 @@ include "../functions.php"; $_SESSION["url"] = $_SERVER['REQUEST_URI']; if ($_SESSION["userId"] <> "") { $_SESSION["isLoggedIn"] = true; - $customer_data = getCustomerbyLoginId($_SESSION["userId"]); + //$customer_data = getCustomerbyLoginId($_SESSION["userId"]); } else { $_SESSION["isLoggedIn"] = false; header("location: login.php"); @@ -14,8 +14,6 @@ if ($_SESSION["user_type"] != "admin") { header("location: login.php?alert=Only admins allowed here!"); } $products = productList(); - -$vendorSearchResult = $_SESSION["vendorSearchResult"]; ?> @@ -66,8 +64,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"]; - - + @@ -92,22 +89,17 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"]; - -
-
-
- - -
-
+
+ + +
    -
    -
    - +
    diff --git a/vendor-uploads-edit-product-action.php b/vendor-uploads-edit-product-action.php index 4aca644..6b58249 100644 --- a/vendor-uploads-edit-product-action.php +++ b/vendor-uploads-edit-product-action.php @@ -40,6 +40,18 @@ $material = $_POST['material']; //echo '$material: '.$material.'
    '; $token = $_SESSION["token"]; +$quantities = $_POST['quantity']; +$prices = $_POST['price']; + +// Constructing the price matrix +$priceMatrix = array(); +for ($i = 0; $i < count($quantities); $i++) { + $priceMatrix[] = array( + 'quantity' => $quantities[$i], + 'price' => $prices[$i] + ); +} + $response = editProduct( $productId, @@ -66,6 +78,7 @@ $response = editProduct( $color, $material, $size, + $priceMatrix, $token); $array = json_decode($response,true); $_SESSION['newProdictId'] = $array['_id']; diff --git a/vendor-uploads.php b/vendor-uploads.php index b2639a8..a60d129 100644 --- a/vendor-uploads.php +++ b/vendor-uploads.php @@ -118,14 +118,16 @@ $array = json_decode($result, true);
    -
    - -
    + if (!empty($vendorData['vendor_banner'])) { ?> +
    + +
    - +
    - + @@ -134,7 +136,7 @@ $array = json_decode($result, true); vendor image
    -
    +
    +
    + + + + + + + + + + + $pair) : ?> + + + + + + + + +
    QuantityPrice (PHP)
    + +
    +
    -
    +
    - style="background-color: blue;"> - -
    -
    -
    -
    - style="background-color: blue;"> - + style="background-color: blue;"> +
    - style="background-color: blue;"> - + style="background-color: blue;"> + +
    +
    +
    +
    + style="background-color: blue;"> +
    @@ -473,7 +500,7 @@ $array = json_decode($result, true); + +
    diff --git a/user-profile.php b/user-profile.php index 71eca38..e3ae4f4 100644 --- a/user-profile.php +++ b/user-profile.php @@ -114,7 +114,7 @@ if ($_SESSION["userId"] <> "") { - +
    @@ -168,7 +168,7 @@ if ($_SESSION["userId"] <> "") {
    -
    + diff --git a/user-refund-history.php b/user-refund-history.php index 95a6416..8bfcbcc 100644 --- a/user-refund-history.php +++ b/user-refund-history.php @@ -49,7 +49,7 @@ if ($_SESSION["userId"] <> "") { --> + + + + + + + oBanana B2B - Admin Dashboard + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + +
    +
    +
    Vendor Search Results
    +
    + +
    +
    +
    +
    + +
    +
    + "> + + +
    +
    +
    +
    +
    Seller Products
    + +

    +
    +
    +
    +
    +
    Seller since
    +

    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + + + + +
    +
    +
    + $productListVendor) { + // echo "$product .":" . $productListVendor"; + // $vendorOfProduct = getVendorbyId($product['vendor_api_id']); + + $products = productListVendor($vendorId); + $totalProducts = count($products); + + + for ($i = 0; $i <= $totalProducts - 1; $i++) { + $product = $products[$i]; + ?> +
    +
    +
    +
    +
    + + edit + + edit + +
    +
    +
    +

    +

    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/catalog-single-vendor-action.php b/catalog-single-vendor-action.php new file mode 100644 index 0000000..d9812af --- /dev/null +++ b/catalog-single-vendor-action.php @@ -0,0 +1,30 @@ + "") { } else { $_SESSION["isLoggedIn"] = false; } +$products = productListVendor($_GET["id"]); + +$filteredProducts = []; + +if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['category'])) { + $filteredProducts = []; + $minPrice = isset($_GET['minPrice']) && $_GET['minPrice'] !== '' ? floatval($_GET['minPrice']) : null; + $maxPrice = isset($_GET['maxPrice']) && $_GET['maxPrice'] !== '' ? floatval($_GET['maxPrice']) : null; + + // echo "Min Price: " . ($minPrice !== null ? $minPrice : "null") . "
    "; + // echo "Max Price: " . ($maxPrice !== null ? $maxPrice : "null") . "
    "; + + $selectedCategories = isset($_GET['category']) ? $_GET['category'] : []; + + if (!empty($selectedCategories) && (($minPrice == null) && ($maxPrice == null))) { + // var_dump("filtering categories without price"); + foreach ($selectedCategories as $selectedCategory) { + $category = strtolower(trim($selectedCategory)); + foreach ($products as $result) { + $product = $result; + + $productCategory = strtolower(trim($product['product_category'])); + + if ( + $productCategory == $category + ) { + $filteredProducts[] = $result; + } + } + } + } elseif (!empty($selectedCategories) && (!empty($minPrice) || !empty($maxPrice))) { + // var_dump("filtering categories and price"); + if ($minPrice === null) { + $minPrice = 0; + } + if ($maxPrice === null) { + $maxPrice = PHP_FLOAT_MAX; + } + foreach ($selectedCategories as $selectedCategory) { + $category = strtolower(trim($selectedCategory)); + foreach ($products as $result) { + $product = $result; + $productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price']; + $productCategory = strtolower(trim($product['product_category'])); + if ( + $productCategory = $category && (($productPrice >= $minPrice) && + ($productPrice <= $maxPrice)) + ) { + $filteredProducts[] = $result; + } + } + } + } + else { + foreach ($products as $result) { + // var_dump("filtering"); + $product = $result; + $productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price']; + // var_dump( $minPrice); + // var_dump( $productPrice); + // var_dump( $productPrice >= $minPrice); + + + + if ($minPrice === null) { + $minPrice = 0; + } + + if ($maxPrice === null) { + $maxPrice = PHP_FLOAT_MAX; + } + if (($minPrice === null || $productPrice >= $minPrice) && + ($maxPrice === null || $productPrice <= $maxPrice) + ) { + $filteredProducts[] = $result; + // var_dump("filtering heree"); + + } + } + } +} else { + $filteredProducts = $products; +} ?> @@ -268,7 +351,6 @@ if ($_SESSION["userId"] <> "") {
    Seller Products

    Products

    @@ -334,7 +416,7 @@ if ($_SESSION["userId"] <> "") {
    "") { } } else { ?> - edit + edit @@ -489,64 +571,83 @@ if ($_SESSION["userId"] <> "") {
    -
    -

    Category

    -
    -
    - + + +
    -
    x From b8ac7f827d14b18b58ba4fd0bcea49f170e19adf Mon Sep 17 00:00:00 2001 From: jouls Date: Wed, 20 Mar 2024 14:59:13 +0800 Subject: [PATCH 06/15] added payout table and modal --- vendor-payouts.php | 189 ++++++++++++++++++++++++++++++++++--------- vendor-user-tabs.php | 2 +- 2 files changed, 154 insertions(+), 37 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index 6f8659e..53bf663 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -24,6 +24,17 @@ if ($_SESSION["userId"] <> "") { ?> + @@ -141,61 +152,114 @@ if ($_SESSION["userId"] <> "") {
    -
    +
    -
    Upcoming Payout
    +
    Upcoming Payout
    -
    - Panel content +
    +
    +

    +
    + + ₱ 0.00 + +
    +

    +
    + Payout Generation: Tue, Mar 19, 2024 +
    +
    + Receive Payout on or before: Wed, Mar 20, 2024 +
    +
    + Receipient: Philippine National Bank (PNB) Account ending in 6685 +
    +
    -
    +
    -
    Payout Generation Schedule
    +
    Payout Generation Schedule
    -
    - Panel content +
    +
    +

    +
    + + + Weekly + +
    +

    +
    +
    + Every Tuesday +
    +
    +
    + Payouts that will fall on holiday will be processed the next banking day +
    +
    -
    +
    -
    Next Payout
    +
    Next Payout
    -
    - Panel content +
    +
    +

    +
    + + ₱ 0.00 + +
    +

    +
    + Payout Generation: Tue, Mar 25, 2024 +
    +
    + Receive Payout on or before: Wed, Mar 26, 2024 +
    +
    + Receipient: Philippine National Bank (PNB) Account ending in 6685 +
    +
    -
    -
    Payout History
    - - - - - - - - - +
    +
    Payout History
    +
    +
    AmountBankAccount NumberPayout GenerationStatusAction
    + + + + + + + + - - - - - - - - - - -
    AmountBankAccount NumberPayout GenerationStatusAction
    PHP 1,165.65 EastWest Bank ****6618 December 08, 2023 Deposited - Details -
    + + + + ₱ 1,165.65 + EastWest Bank + ****6618 + December 08, 2023 + Deposited + + Details + + + +
    @@ -204,6 +268,59 @@ if ($_SESSION["userId"] <> "") {
    + + + diff --git a/vendor-user-tabs.php b/vendor-user-tabs.php index 8e77193..96944df 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
  • +
  • >My Payouts
  • From 2ee9074e8615442f56770931402c53ffb8f5f2c7 Mon Sep 17 00:00:00 2001 From: jouls Date: Wed, 20 Mar 2024 17:03:45 +0800 Subject: [PATCH 07/15] Added Stylings to Payout Details, and Table --- vendor-payouts.php | 120 +++++++++++++++++++++++++++++++++++++------ vendor-user-tabs.php | 2 +- 2 files changed, 104 insertions(+), 18 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index 53bf663..38e345d 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -255,7 +255,11 @@ if ($_SESSION["userId"] <> "") { December 08, 2023 Deposited - Details + + + @@ -268,36 +272,66 @@ if ($_SESSION["userId"] <> "") {
    - -