Added total users and new vendors table, improvements on recent orders table

This commit is contained in:
jouls 2024-04-25 18:21:15 +08:00
parent 8858763cd6
commit 0dfa648b19
1 changed files with 99 additions and 81 deletions

View File

@ -734,9 +734,17 @@ $allSignups = array_merge($all_customers, $all_vendors);
<div class="col-xl-3 col-sm-6 p-b-15 lbl-card">
<div class="card card-mini dash-card card-2">
<div class="card-body">
<h2 class="mb-1">79,503</h2>
<p>Daily Visitors</p>
<span class="mdi mdi-account-clock"></span>
<?php
$userCount = 0;
foreach ($allSignups as $signup) {
$userCount++;
}
?>
<h2 class="mb-1"><?php echo $userCount; ?></h2>
<!-- <h2 class="mb-1">79,503</h2> -->
<p>Total Users</p>
<span class="mdi mdi-account-multiple"></span>
</div>
</div>
</div>
@ -763,7 +771,7 @@ $allSignups = array_merge($all_customers, $all_vendors);
$finalDailyRevenue = number_format($dailyRevenue, 2, '.', ',');
?>
<h2 class="mb-1"><?php echo $orderCount; ?></h2>
<p>Today's Order</p>
<p>Today's Orders</p>
<span class="mdi mdi-package-variant"></span>
</div>
</div>
@ -1040,7 +1048,7 @@ $allSignups = array_merge($all_customers, $all_vendors);
style="width:100%">
<thead>
<tr>
<th>Order ID</th>
<th>Payment Method</th>
<th>Customer Name</th>
<th class="d-none d-lg-table-cell">Vendor Name</th>
<th class="d-none d-lg-table-cell">Total Amount</th>
@ -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']));
?>
<tr>
<td><?php echo $orderId ?></td>
<td><?php echo $paymentMethod ?></td>
<td><?php echo $customerName ?></td>
<td><?php echo $vendorName ?></td>
<td><?php echo $totalAmount ?></td>
<td> <?php echo number_format($totalAmount, 2, '.', ',') ?></td>
<td><?php echo $displayDate ?></td>
<td><span style="color: <?php echo $statusClass; ?>"><?php echo $orderStatus ?></span></td>
</tr>
@ -1103,12 +1112,11 @@ $allSignups = array_merge($all_customers, $all_vendors);
</div>
<div class="row">
<div class="col-xl-5">
<div class="col-xl-6">
<!-- New Customers -->
<div class="card ec-cust-card card-table-border-none card-default">
<div class="card-header justify-content-between ">
<?php
$iterationCount = 0;
$weekAgoDate = date('m-d-Y', strtotime('-7 days'));
?>
<h2>New Customers</h2>
@ -1134,12 +1142,17 @@ $allSignups = array_merge($all_customers, $all_vendors);
<table class="table ">
<tbody>
<?php
$iterationCount = 0;
$customersDisplayed = false;
foreach (array_reverse($all_customers) as $x => $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;
?>
<tr>
<td>
@ -1160,11 +1173,18 @@ $allSignups = array_merge($all_customers, $all_vendors);
</tr>
<?php
$iterationCount++;
if ($iterationCount >= 15) {
if ($iterationCount >= 8) {
break;
}
}
}
if (!$customersDisplayed) {
?>
<tr>
<td class="align-self-center">No new vendors in the past week</td>
</tr>
<?php
}
?>
</tbody>
</table>
@ -1172,83 +1192,81 @@ $allSignups = array_merge($all_customers, $all_vendors);
</div>
</div>
<div class="col-xl-7">
<!-- Top Products -->
<div class="card card-default ec-card-top-prod">
<div class="card-header justify-content-between">
<h2>Top Products</h2>
<div>
<button class="text-black-50 mr-2 font-size-20"><i
class="mdi mdi-cached"></i></button>
<div class="col-xl-6">
<!-- New Customers -->
<div class="card ec-cust-card card-table-border-none card-default">
<div class="card-header justify-content-between ">
<?php
$weekAgoDate = date('m-d-Y', strtotime('-7 days'));
?>
<h2>New Vendors</h2>
<div> From <?php echo $weekAgoDate; ?> to <?php echo $currentDate; ?></div>
<!-- <div>
<button class="text-black-50 mr-2 font-size-20">
<i class="mdi mdi-cached"></i>
</button>
<div class="dropdown show d-inline-block widget-dropdown">
<a class="dropdown-toggle icon-burger-mini" href="#" role="button"
id="dropdown-product" data-bs-toggle="dropdown" aria-haspopup="true"
id="dropdown-customar" data-bs-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" data-display="static">
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li class="dropdown-item"><a href="#">Update Data</a></li>
<li class="dropdown-item"><a href="#">Detailed Log</a></li>
<li class="dropdown-item"><a href="#">Statistics</a></li>
<li class="dropdown-item"><a href="#">Clear Data</a></li>
<li class="dropdown-item"><a href="#">Action</a></li>
<li class="dropdown-item"><a href="#">Another action</a></li>
<li class="dropdown-item"><a href="#">Something else here</a></li>
</ul>
</div>
</div>
</div> -->
</div>
<div class="card-body mt-10px mb-10px py-0">
<div class="row media d-flex pt-15px pb-15px">
<div
class="col-lg-3 col-md-3 col-2 media-image align-self-center rounded">
<a href="#"><img loading="lazy" src="assets/img/products/p1.jpg" alt="customer image"></a>
</div>
<div class="col-lg-9 col-md-9 col-10 media-body align-self-center ec-pos">
<a href="#">
<h6 class="mb-10px text-dark font-weight-medium">Baby cotton shoes</h6>
</a>
<p class="float-md-right sale"><span class="mr-2">58</span>Sales</p>
<p class="d-none d-md-block">Statement belting with double-turnlock hardware
adds “swagger” to a simple.</p>
<p class="mb-0 ec-price">
<span class="text-dark">$520</span>
<del>$580</del>
</p>
</div>
</div>
<div class="row media d-flex pt-15px pb-15px">
<div
class="col-lg-3 col-md-3 col-2 media-image align-self-center rounded">
<a href="#"><img loading="lazy" src="assets/img/products/p2.jpg" alt="customer image"></a>
</div>
<div class="col-lg-9 col-md-9 col-10 media-body align-self-center ec-pos">
<a href="#">
<h6 class="mb-10px text-dark font-weight-medium">Hoodies for men</h6>
</a>
<p class="float-md-right sale"><span class="mr-2">20</span>Sales</p>
<p class="d-none d-md-block">Statement belting with double-turnlock hardware
adds “swagger” to a simple.</p>
<p class="mb-0 ec-price">
<span class="text-dark">$250</span>
<del>$300</del>
</p>
</div>
</div>
<div class="row media d-flex pt-15px pb-15px">
<div
class="col-lg-3 col-md-3 col-2 media-image align-self-center rounded">
<a href="#"><img loading="lazy" src="assets/img/products/p3.jpg" alt="customer image"></a>
</div>
<div class="col-lg-9 col-md-9 col-10 media-body align-self-center ec-pos">
<a href="#">
<h6 class="mb-10px text-dark font-weight-medium">Long slive t-shirt</h6>
</a>
<p class="float-md-right sale"><span class="mr-2">10</span>Sales</p>
<p class="d-none d-md-block">Statement belting with double-turnlock hardware
adds “swagger” to a simple.</p>
<p class="mb-0 ec-price">
<span class="text-dark">$480</span>
<del>$654</del>
</p>
</div>
</div>
<div class="card-body pt-0 pb-15px">
<table class="table ">
<tbody>
<?php
$iterationCount = 0;
$vendorsDisplayed = false;
foreach (array_reverse($all_vendors) as $x => $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;
?>
<tr>
<td>
<div class="media">
<div class="media-image mr-3 rounded-circle">
<img loading="lazy"
class="profile-img rounded-circle w-45"
src="<?php echo $imageUrl !== null ? $imageUrl : 'assets/img/user/u1.jpg'; ?>"
alt="customer image">
</div>
<div class="media-body align-self-center">
<h6 class="mt-0 text-dark font-weight-medium"><?php echo $fullName; ?></h6>
<small><?php echo $email; ?></small>
</div>
</div>
</td>
<td><?php echo $formattedSignupDate?></td>
</tr>
<?php
$iterationCount++;
if ($iterationCount >= 8) {
break;
}
}
}
if (!$vendorsDisplayed) {
?>
<tr>
<td class="align-self-center" colspan="2">No new vendors in the past week</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>