diff --git a/admin/index.php b/admin/index.php index 1da4c50..9944da9 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); + ?> @@ -107,7 +114,7 @@ date_default_timezone_set('Asia/Manila');
  • - + My Profile
  • @@ -707,8 +714,19 @@ date_default_timezone_set('Asia/Manila');
    -

    1,503

    -

    Daily Signups

    + +

    + +

    Today's Signups

    @@ -716,9 +734,17 @@ date_default_timezone_set('Asia/Manila');
    -

    79,503

    -

    Daily Visitors

    - + +

    + +

    Total Users

    +
    @@ -726,18 +752,19 @@ date_default_timezone_set('Asia/Manila');
    $val) { + foreach (array_reverse($all_orders) as $x => $val) { $paymentStatus = strtolower($val['payment']['status']); - + $returnStatus = strtolower($val['return_order']['status']); + $orderStatus = strtolower($val['status']); $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); if ($formattedOrderDate == $currentDate) { $orderCount++; - if($paymentStatus == "paid"){ - $dailyRevenue += $val['total_amount']; + if($paymentStatus == "paid" && (!$returnStatus || $orderStatus != "returned" )){ + $dailyRevenue += $val['total_amount']; } // Increment order count for each order on the current date } } @@ -745,7 +772,7 @@ date_default_timezone_set('Asia/Manila'); $finalDailyRevenue = number_format($dailyRevenue, 2, '.', ','); ?>

    -

    Today's Order

    +

    Today's Orders

    @@ -766,7 +793,6 @@ date_default_timezone_set('Asia/Manila');
    -

    Sales Report

    @@ -1023,26 +1049,31 @@ date_default_timezone_set('Asia/Manila'); style="width:100%"> - Order ID + Payment Method Customer Name Vendor Name Total Amount Order Date Status - + Return Status $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']); + $returnStatus = strtoupper($val['return_order']['status']); + + $statusClass = ''; if ($orderStatus === 'UNPAID' || $orderStatus === 'RETURNED') { @@ -1059,23 +1090,34 @@ date_default_timezone_set('Asia/Manila'); } if ($formattedOrderDate == $currentDate) { + $ordersDisplayed = true; + $displayDate = date('m-d-Y, g:i A', strtotime($val['order_date'])); ?> - + - + ₱ + = 8) { - break; - } + $iterationCount++; + if ($iterationCount >= 8) { + break; } + } + } + + if (!$ordersDisplayed) { + ?> + + No Recent Orders Yet. + + @@ -1086,12 +1128,16 @@ date_default_timezone_set('Asia/Manila');
    -
    +
    +

    New Customers

    -
    +
    From to
    +
    + $val) { + $formattedSignupDate = date('m-d-Y', strtotime($val['createdAt'])); + $imageUrl = $val['customer_image']; + $fullName = $val['first_name'] . ' ' . $val['last_name']; + $email = $val['user_email']; + if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) { + $customersDisplayed = true; + + ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - + + = 8) { + break; + } + } + } + if (!$customersDisplayed) { + ?> + + + +
    - 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
    No new customers in the past week
    -
    - -
    -
    -

    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']; + $shopName = $val['user_login']; + $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
    @@ -1333,7 +1298,7 @@ date_default_timezone_set('Asia/Manila');

    Copyright © Ekka Admin Dashboard. All Rights Reserved. -

    +

    diff --git a/admin/order-history.php b/admin/order-history.php index 1fcec6e..d786135 100644 --- a/admin/order-history.php +++ b/admin/order-history.php @@ -14,7 +14,7 @@ if ($_SESSION["user_type"] != "admin") { header("location: login.php?alert=Only admins allowed here!"); } $orders = getAllOrder(); -$allorders = json_encode($orders, true); +// $allorders = json_encode($orders, true); ?> @@ -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); ?> + 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 diff --git a/register.php b/register.php index e09d9cb..3acd4e0 100644 --- a/register.php +++ b/register.php @@ -112,9 +112,6 @@ $_SESSION["isVendor"] = false;

    I accept this Terms & Conditions and Privacy Policy

    - 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