From 31f38da140b6109ab3b5f647f0e70a9cd699d098 Mon Sep 17 00:00:00 2001 From: jouls Date: Wed, 17 Apr 2024 10:45:14 +0800 Subject: [PATCH 01/16] fixed routing issue in forgot_password --- login_action.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/login_action.php b/login_action.php index adb9c4e..46ae719 100644 --- a/login_action.php +++ b/login_action.php @@ -19,7 +19,13 @@ if ($result > 0) { $_SESSION["isVendor"] = true; } - header("location: $url"); + + if ($url == "/forgot_password.php" || $url == "/forget_otp.php") + { + header("location: index.php"); + }else { + header("location: $url"); + } } else { // $_SESSION["loginError"] = "Invalid email or password. Please try again."; header("location: login.php?error=1"); From 096cc84506268b9ee5053b988ab275aeb151297b Mon Sep 17 00:00:00 2001 From: jouls Date: Wed, 17 Apr 2024 11:00:04 +0800 Subject: [PATCH 02/16] added renewToken script on vendor_payouts --- vendor-payouts.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vendor-payouts.php b/vendor-payouts.php index fad7345..b9af224 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -84,6 +84,24 @@ $vendorPayoutData = json_decode($response, true); + + From 2ab77fe7495fd578fd295dd615f11835b7663c7c Mon Sep 17 00:00:00 2001 From: jouls Date: Wed, 17 Apr 2024 17:07:27 +0800 Subject: [PATCH 03/16] Added formatting for transaction_date and proper label for modal box --- vendor-payouts.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vendor-payouts.php b/vendor-payouts.php index b9af224..4ecb0b4 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -338,7 +338,7 @@ $vendorPayoutData = json_decode($response, true); -
+ +
-
Receipient: Philippine National Bank (PNB) Account ending in
- + -->
Payout History
From 3d9d52dfcc3400d17a04f4b03e409e295e25d873 Mon Sep 17 00:00:00 2001 From: jouls Date: Thu, 18 Apr 2024 18:03:20 +0800 Subject: [PATCH 05/16] Added recent orders, daily orders, daily revenue --- admin/index.php | 228 ++++++++++++++++-------------------------------- 1 file changed, 77 insertions(+), 151 deletions(-) diff --git a/admin/index.php b/admin/index.php index 21284dc..5c7fab5 100644 --- a/admin/index.php +++ b/admin/index.php @@ -13,6 +13,10 @@ if ($_SESSION["userId"] <> "") { if($_SESSION["user_type"]!="admin"){ header("location: login.php?alert=Only admins allowed here!"); } + +$all_orders = getAllOrder(); + +$num_orders = count($all_orders); ?> @@ -719,8 +723,27 @@ if($_SESSION["user_type"]!="admin"){
-

15,503

-

Daily Order

+ $val) { + $paymentStatus = strtolower($val['payment']['status']); + + $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); + if ($formattedOrderDate == $currentDate) { + $orderCount++; + if($paymentStatus == "paid"){ + $dailyRevenue += $val['total_amount']; + } // Increment order count for each order on the current date + } + } + + $finalDailyRevenue = number_format($dailyRevenue, 2, '.', ','); + ?> +

+

Today's Order

@@ -728,9 +751,9 @@ if($_SESSION["user_type"]!="admin"){
-

$98,503

-

Daily Revenue

- +

+

Today's Revenue

+
@@ -741,6 +764,7 @@ if($_SESSION["user_type"]!="admin"){
+

Sales Report

@@ -995,9 +1019,6 @@ if($_SESSION["user_type"]!="admin"){

Recent Orders

-
- -
- - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + $val) { + date_default_timezone_set('Asia/Manila'); + $paymentStatus = strtolower($val['payment']['status']); + $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); + $orderId = $val['_id']; + $customerName = $val['customer'][0]['name']; + $vendorName = $val['items'][0]['vendor_name']; + $totalAmount = $val['total_amount']; + $orderStatus = strtoupper($val['status']); + + $statusClass = ''; + if ($orderStatus === 'UNPAID') { + $statusClass = '#cb3747'; + } elseif ($orderStatus === 'TO PAY') { + $statusClass = '#4a90e2'; + } elseif ($orderStatus === 'TO SHIP') { + $statusClass = '#ffcc66'; + } + elseif ($orderStatus === 'TO RECEIVE') { + $statusClass = '#ffc319'; + } elseif ($orderStatus === 'COMPLETED') { + $statusClass = '#56ba5a'; + } + + if ($formattedOrderDate == $currentDate) { + $displayDate = date('m-d-Y, g:i A', strtotime($val['order_date'])); + ?> + + + + + + + + + +
Order IDProduct NameUnitsCustomer NameVendor NameTotal Amount Order DateOrder Cost Status
24541 - Coach Swagger - 1 UnitOct 20, 2018$230 - Completed - - -
24541 - Toddler Shoes, Gucci Watch - 2 UnitsNov 15, 2018$550 - Delayed - - -
24541 - Hat Black Suits - 1 UnitNov 18, 2018$325 - On Hold - - -
24541 - Backpack Gents, Swimming Cap Slin - 5 UnitsDec 13, 2018$200 - Completed - - -
24541 - Speed 500 Ignite - 1 UnitDec 23, 2018$150 - Cancelled - - -
From d1bf1a639556ee866607a6c51bc151144b7822bc Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 19 Apr 2024 08:53:13 +0800 Subject: [PATCH 06/16] fixed admin-payments table amount and formatted date --- admin/vendor-profile.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php index 11acc9f..7769b04 100644 --- a/admin/vendor-profile.php +++ b/admin/vendor-profile.php @@ -83,7 +83,7 @@ if (isset($_SESSION["token"])) { // $token = loginRenew($_SESSION["email"], $_SESSION["password"], $token); // $_SESSION["token"] = $token; - +date_default_timezone_set('Asia/Manila'); ?> @@ -288,7 +288,7 @@ if (isset($_SESSION["token"])) {
- +
@@ -312,12 +312,13 @@ if (isset($_SESSION["token"])) { if ($orderItems['payment']['status'] === 'PAID') { foreach ($orderItems['items'] as $item) { + $displayDate = date('m-d-Y, g:i A', strtotime($orderItems['updatedAt'])); $isPayoutCompleted = !empty($orderItems['payout_status']); ?> - + @@ -327,7 +328,7 @@ if (isset($_SESSION["token"])) { - +
> @@ -824,11 +825,7 @@ date_default_timezone_set('Asia/Manila');
  • Order Pending
  • -
  • Order Canceled
  • -
  • Order Broken
  • + style="color: #8061ef">Order To Ship
@@ -1354,6 +1351,8 @@ date_default_timezone_set('Asia/Manila'); + + diff --git a/vendor-payments.php b/vendor-payments.php index 486de53..aab47e6 100644 --- a/vendor-payments.php +++ b/vendor-payments.php @@ -488,10 +488,10 @@ if ($_SESSION["isCustomer"] == true) { console.log(response); var paymentId = response.payment.reference_number; $('#paymentIdSpan').text(paymentId); - var gross_price = response.payment.details[0]?.attributes.data.attributes.amount; + var gross_price = (response.payment.details[0]?.attributes.data.attributes.amount / 100).toFixed(2); var payment_status = response.payment.status; var fee = response.payment.details[0]?.attributes.data.attributes.fee; - var net_amount = response.payment.details[0]?.attributes.data.attributes.payments[0].attributes.net_amount; + var net_amount = (response.payment.details[0]?.attributes.data.attributes.payments[0].attributes.net_amount / 100).toFixed(2); var desc = response.items[0].product.name; var method = response.payment_method; var name = response.billing_address.billing_first_name + " " + response.billing_address.billing_last_name; @@ -522,7 +522,7 @@ if ($_SESSION["isCustomer"] == true) {
Gross Amount
-
₱ ${net_amount}
+
₱ ${gross_price}
Fees
Net Amount
-
₱ ${gross_price}
+
₱ ${net_amount}
Payment Description
@@ -598,7 +598,7 @@ if ($_SESSION["isCustomer"] == true) {
Net Amount
-
₱ ${gross_price}
+
₱ ${net_amount}
Payment Description