From 46995fef7b14a687626e9de6488fd1329a751739 Mon Sep 17 00:00:00 2001 From: jouls Date: Thu, 25 Apr 2024 15:16:37 +0800 Subject: [PATCH 01/13] removed forgot pass in register user --- register.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/register.php b/register.php index 8bf48de..282135a 100644 --- a/register.php +++ b/register.php @@ -112,9 +112,6 @@ $_SESSION["isVendor"] = false;

I accept this Terms & Conditions and Privacy Policy

- - - From 35a6c3b6938ec3021f4887983d1f487b411f4599 Mon Sep 17 00:00:00 2001 From: jouls Date: Thu, 25 Apr 2024 15:34:57 +0800 Subject: [PATCH 02/13] added functions for getAllCustomers and getAllVendors --- functions.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/functions.php b/functions.php index d8bd171..9ff8b31 100644 --- a/functions.php +++ b/functions.php @@ -2010,3 +2010,48 @@ function updatePayout($token, $payoutId) return $response; } +function getAllCustomers () +{ + $curl = curl_init(); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers", + 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); + + return $json; +} + +function getAllVendors () +{ + $curl = curl_init(); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", + 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); + + return $json; +} \ No newline at end of file From 793afa339fd83c168a47b0a9822d6687d819b280 Mon Sep 17 00:00:00 2001 From: jouls Date: Thu, 25 Apr 2024 15:35:16 +0800 Subject: [PATCH 03/13] Added Daily Signup Counter --- admin/index.php | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/admin/index.php b/admin/index.php index 1da4c50..97e83f9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -14,8 +14,15 @@ if($_SESSION["user_type"]!="admin"){ header("location: login.php?alert=Only admins allowed here!"); } -$all_orders = getAllOrder(); date_default_timezone_set('Asia/Manila'); +$currentDate = date('m-d-Y'); + +$all_orders = getAllOrder(); +$all_customers = getAllCustomers(); +$all_vendors = getAllVendors(); + +$allSignups = array_merge($all_customers, $all_vendors); + ?> @@ -707,8 +714,19 @@ date_default_timezone_set('Asia/Manila');
-

1,503

-

Daily Signups

+ +

+ +

Today's Signups

@@ -726,7 +744,7 @@ date_default_timezone_set('Asia/Manila');
-

Sales Report

From 8858763cd66a997bf23714370cbd8d9b8b77227c Mon Sep 17 00:00:00 2001 From: jouls Date: Thu, 25 Apr 2024 17:18:36 +0800 Subject: [PATCH 04/13] Added New Customers Table --- admin/index.php | 158 +++++++++++------------------------------------- 1 file changed, 35 insertions(+), 123 deletions(-) diff --git a/admin/index.php b/admin/index.php index 97e83f9..1aea4b9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1088,10 +1088,10 @@ $allSignups = array_merge($all_customers, $all_vendors); = 8) { - break; - } + $iterationCount++; + if ($iterationCount >= 8) { + break; + } } } ?> @@ -1107,8 +1107,13 @@ $allSignups = array_merge($all_customers, $all_vendors);
+

New Customers

-
+
From to
+
+ $val) { + $formattedSignupDate = date('m-d-Y', strtotime($val['createdAt'])); + $imageUrl = $val['file_path_image']; + $fullName = $val['first_name'] . ' ' . $val['last_name']; + $email = $val['user_email']; + if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) { + ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - + + = 15) { + break; + } + } + } + ?>
- customer image + customer image
- -
Selena - Wagner
-
- @selena.oi +
+
2 Orders$150
-
-
- customer image -
-
- -
Walter - Reuter
-
- @walter.me -
-
-
5 Orders$200
-
-
- customer image -
-
- -
Larissa - Gebhardt
-
- @larissa.gb -
-
-
1 Order$50
-
-
- customer image -
-
- -
Albrecht - Straub
-
- @albrech.as -
-
-
2 Orders$100
-
-
- customer image -
-
- -
Leopold - Ebert
-
- @leopold.et -
-
-
1 Order$60
-
-
- customer image -
-
- -
Larissa - Gebhardt
-
- @larissa.gb -
-
-
1 Order$50
@@ -1350,7 +1262,7 @@ $allSignups = array_merge($all_customers, $all_vendors);

Copyright © Ekka Admin Dashboard. All Rights Reserved. -

+

From 0dfa648b19c54200539d98101a63e746a45db550 Mon Sep 17 00:00:00 2001 From: jouls Date: Thu, 25 Apr 2024 18:21:15 +0800 Subject: [PATCH 05/13] Added total users and new vendors table, improvements on recent orders table --- admin/index.php | 180 ++++++++++++++++++++++++++---------------------- 1 file changed, 99 insertions(+), 81 deletions(-) diff --git a/admin/index.php b/admin/index.php index 1aea4b9..b4fbff9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -734,9 +734,17 @@ $allSignups = array_merge($all_customers, $all_vendors);
-

79,503

-

Daily Visitors

- + +

+ +

Total Users

+
@@ -763,7 +771,7 @@ $allSignups = array_merge($all_customers, $all_vendors); $finalDailyRevenue = number_format($dailyRevenue, 2, '.', ','); ?>

-

Today's Order

+

Today's Orders

@@ -1040,7 +1048,7 @@ $allSignups = array_merge($all_customers, $all_vendors); style="width:100%"> - Order ID + Payment Method Customer Name Vendor Name Total Amount @@ -1055,11 +1063,12 @@ $allSignups = array_merge($all_customers, $all_vendors); foreach (array_reverse($all_orders) as $x => $val) { $paymentStatus = strtolower($val['payment']['status']); $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); - $orderId = $val['_id']; + $paymentMethod = $val['payment_method']; $customerName = $val['customer'][0]['name']; $vendorName = $val['items'][0]['vendor_name']; $totalAmount = $val['total_amount']; $orderStatus = strtoupper($val['status']); + $statusClass = ''; if ($orderStatus === 'UNPAID' || $orderStatus === 'RETURNED') { @@ -1079,10 +1088,10 @@ $allSignups = array_merge($all_customers, $all_vendors); $displayDate = date('m-d-Y, g:i A', strtotime($val['order_date'])); ?> - + - + ₱ @@ -1103,12 +1112,11 @@ $allSignups = array_merge($all_customers, $all_vendors);
-
+

New Customers

@@ -1134,12 +1142,17 @@ $allSignups = array_merge($all_customers, $all_vendors); $val) { $formattedSignupDate = date('m-d-Y', strtotime($val['createdAt'])); - $imageUrl = $val['file_path_image']; + $imageUrl = $val['customer_image']; $fullName = $val['first_name'] . ' ' . $val['last_name']; $email = $val['user_email']; if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) { + $customersDisplayed = true; + ?> = 15) { + if ($iterationCount >= 8) { break; } } } + if (!$customersDisplayed) { + ?> + + + +
@@ -1160,11 +1173,18 @@ $allSignups = array_merge($all_customers, $all_vendors);
No new vendors in the past week
@@ -1172,83 +1192,81 @@ $allSignups = array_merge($all_customers, $all_vendors);
-
- -
-
-

Top Products

-
- +
+ +
+
+ +

New Vendors

+
From to
+
-
-
-
- customer image -
-
- -
Baby cotton shoes
-
-

58Sales

-

Statement belting with double-turnlock hardware - adds “swagger” to a simple.

-

- $520 - $580 -

-
-
-
-
- customer image -
-
- -
Hoodies for men
-
-

20Sales

-

Statement belting with double-turnlock hardware - adds “swagger” to a simple.

-

- $250 - $300 -

-
-
-
-
- customer image -
-
- -
Long slive t-shirt
-
-

10Sales

-

Statement belting with double-turnlock hardware - adds “swagger” to a simple.

-

- $480 - $654 -

-
-
+
+ + + $val) { + $formattedSignupDate = date('m-d-Y', strtotime($val['createdAt'])); + $imageUrl = $val['vendor_image']; + $fullName = $val['first_name'] . ' ' . $val['last_name']; + $email = $val['user_email']; + if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) { + $vendorsDisplayed = true; + ?> + + + + + = 8) { + break; + } + } + } + + if (!$vendorsDisplayed) { + ?> + + + + + +
+
+
+ customer image +
+
+
+ +
+
+
No new vendors in the past week
From e30cbcebd725add84c495dbf9dc01de03565a17b Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 26 Apr 2024 13:01:28 +0800 Subject: [PATCH 06/13] improvements on admin dashboard and order history --- admin/index.php | 18 +++++++++++++++--- admin/order-history.php | 10 ++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/admin/index.php b/admin/index.php index b4fbff9..efbe96a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -114,7 +114,7 @@ $allSignups = array_merge($all_customers, $all_vendors);
  • - + My Profile
  • @@ -1060,6 +1060,8 @@ $allSignups = array_merge($all_customers, $all_vendors); $val) { $paymentStatus = strtolower($val['payment']['status']); $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); @@ -1085,6 +1087,8 @@ $allSignups = array_merge($all_customers, $all_vendors); } if ($formattedOrderDate == $currentDate) { + $ordersDisplayed = true; + $displayDate = date('m-d-Y, g:i A', strtotime($val['order_date'])); ?> @@ -1103,6 +1107,14 @@ $allSignups = array_merge($all_customers, $all_vendors); } } } + + if (!$ordersDisplayed) { + ?> + + No Recent Orders Yet. + + @@ -1181,7 +1193,7 @@ $allSignups = array_merge($all_customers, $all_vendors); if (!$customersDisplayed) { ?> - No new vendors in the past week + No new customers in the past week - No new vendors in the past week + No new vendors in the past week @@ -24,9 +24,9 @@ $allorders = json_encode($orders, true); - + - Ekka - Admin Dashboard HTML Template. + oBanana B2B - Admin Dashboard @@ -82,7 +82,8 @@ $allorders = json_encode($orders, true); - + + @@ -102,6 +103,7 @@ $allorders = json_encode($orders, true); ?> + From 88ae2713bbd3877e547cc566635eb91007b1c5da Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 26 Apr 2024 14:26:32 +0800 Subject: [PATCH 07/13] improvements on new vendors table --- admin/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin/index.php b/admin/index.php index efbe96a..e83eaed 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1239,6 +1239,7 @@ $allSignups = array_merge($all_customers, $all_vendors); foreach (array_reverse($all_vendors) as $x => $val) { $formattedSignupDate = date('m-d-Y', strtotime($val['createdAt'])); $imageUrl = $val['vendor_image']; + $shopName = $val['user_login']; $fullName = $val['first_name'] . ' ' . $val['last_name']; $email = $val['user_email']; if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) { @@ -1254,7 +1255,8 @@ $allSignups = array_merge($all_customers, $all_vendors); alt="customer image">
    -
    +
    + ||
    From 0dd203aba2f02b7575b1f5061b0f0ade4040e861 Mon Sep 17 00:00:00 2001 From: jouls Date: Fri, 26 Apr 2024 15:47:05 +0800 Subject: [PATCH 08/13] added error handling for routes on vendor pages --- vendor-all-product-list.php | 5 +++++ vendor-dashboard-orders-edit.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/vendor-all-product-list.php b/vendor-all-product-list.php index 889b1d4..147174b 100644 --- a/vendor-all-product-list.php +++ b/vendor-all-product-list.php @@ -19,6 +19,11 @@ if ($_SESSION["userId"] <> "") { $_SESSION["isLoggedIn"] = false; header("location: login.php"); } + +if ($_SESSION["isCustomer"] == true) { + header("location: user-profile.php"); +} + $products = productList(); ?>
    DateUpdated DateOrder Date Customer Vendor Product