From b63b22756b54382ab751db9c6055c02495a5f203 Mon Sep 17 00:00:00 2001 From: Abu Salah Musha Lemon Date: Wed, 25 Sep 2024 22:54:41 +0600 Subject: [PATCH] update --- app/Http/Controllers/ClientController.php | 2 +- .../views/admin/dashboard.blade copy.php | 783 ++++++++++++++++++ resources/views/admin/dashboard.blade.php | 181 +++- .../views/userTemp/layout/layout.blade.php | 538 ++++++------ resources/views/userTemp/model.blade.php | 2 +- resources/views/userTemp/newRelease.blade.php | 2 - resources/views/userTemp/todaysDeal.blade.php | 64 +- routes/web.php | 6 +- 8 files changed, 1240 insertions(+), 338 deletions(-) create mode 100644 resources/views/admin/dashboard.blade copy.php diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 7695ba8..7f0129e 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -90,7 +90,7 @@ public function shoppingAddress(Request $request){ 'postalCode' => 'required|string|max:10', ]); - shopping_addresses::create([ + shopping_addresses::create([ 'phoneNumber'=>$request->phoneNumber, 'presentAddress'=>$request->presentAddress, 'postalCode'=>$request->postalCode, diff --git a/resources/views/admin/dashboard.blade copy.php b/resources/views/admin/dashboard.blade copy.php new file mode 100644 index 0000000..851d6c4 --- /dev/null +++ b/resources/views/admin/dashboard.blade copy.php @@ -0,0 +1,783 @@ +@extends('admin.layouts.layout') +@section('main') + + +

Page /Dashboard

+
+ @php + // Import the Carbon library with an alias to avoid conflicts + use Carbon\Carbon as Carbon; + + // Get today's date + $today = Carbon::today()->format('Y-m-d'); + + // Calculate total sales today + $totalSalesToday = DB::table('Orders')->whereDate('created_at', $today)->count(); + + // Calculate total sale amount today + $totalSalesAmountToday = DB::table('Orders')->whereDate('created_at', $today)->sum('ProductPrice'); + + // Additional metrics + $totalCustomers = DB::table('Users')->count(); + $totalRevenueThisMonth = DB::table('Orders')->whereMonth('created_at', Carbon::now()->month)->sum('ProductPrice'); + $averageOrderValue = $totalSalesToday > 0 ? $totalSalesAmountToday / $totalSalesToday : 0; + @endphp + +
Dashboard Overview
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Sales Today
+
${{ number_format($totalSalesAmountToday, 2) }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Orders Today
+
{{ $totalSalesToday }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Customers
+
{{ $totalCustomers }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Revenue This Month
+
${{ number_format($totalRevenueThisMonth, 2) }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Average Order Value
+
${{ number_format($averageOrderValue, 2) }}
+
+
+
+
+
+ +
+
+
+ + + @php +// Import necessary classes +//use Carbon\Carbon; + +// Fetch recent orders (last 10) +$recentOrders = DB::table('Orders') + ->orderBy('created_at', 'desc') + ->take(10) + ->get(); + +// Fetch top-selling products +$topSellingProducts = DB::table('Orders') + ->select('ProductId', DB::raw('SUM(ProductQty) as total_quantity')) + ->groupBy('ProductId') + ->orderBy('total_quantity', 'desc') + ->take(5) + ->get(); + +// Fetch abandoned carts +//$abandonedCarts = DB::table('Carts') + //->where('status', 'abandoned') + // ->count(); + +// Fetch pending orders +$pendingOrders = DB::table('Orders') + ->where('Status', 'pending') + ->count(); +@endphp + + +
Sales and Order Management
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Recent Orders (Last 10)
+
{{ $recentOrders->count() }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Top Selling Products
+
{{ $topSellingProducts->sum('total_quantity') }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Abandoned Carts
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Pending Orders
+
{{ $pendingOrders }}
+
+
+
+
+
+ +
+
+
+ + + +
Customer Insights
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
New Customers This Month
+
112.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Customer Feedback Ratings
+
183.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Most Active Customers
+
80.000
+
+
+
+
+
+ +
+ +
+
+ +
Inventory Management
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Low Stock Products
+
112.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Out of Stock Products
+
183.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Newly Added Products
+
80.000
+
+
+
+
+
+ +
+ +
+
+ +
Marketing Performance
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Active Promotions/Coupons
+
112.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Traffic Sources
+
183.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Conversion Rate
+
80.000
+
+
+
+
+
+ +
+ +
+
+ +
Other Useful Widgets
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Pending Customer Inquiries
+
112.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Refunds/Returns
+
183.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Sales Trends (Graph)
+
80.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Wishlist Statistics
+
112
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Visitors Profile

+
+
+
+
+ +
+
Male +
+
Female +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 70.0% + 30.0% + + + + + + + +
+
+
+
+
Female: + 30
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +@endsection \ No newline at end of file diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index b3bb013..1ab8810 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -2,15 +2,163 @@ @section('main') - -

Page /Dashboard

+ @php + // Import the Carbon library with an alias to avoid conflicts + use Carbon\Carbon as Carbon; + + // Get today's date + $today = Carbon::today()->format('Y-m-d'); + + // Calculate total sales today + $totalSalesToday = DB::table('Orders')->whereDate('created_at', $today)->count(); + + // Calculate total sale amount today + $totalSalesAmountToday = DB::table('Orders')->whereDate('created_at', $today)->sum('ProductPrice'); + + // Additional metrics + $totalCustomers = DB::table('Users')->count(); + $totalRevenueThisMonth = DB::table('Orders')->whereMonth('created_at', Carbon::now()->month)->sum('ProductPrice'); + $averageOrderValue = $totalSalesToday > 0 ? $totalSalesAmountToday / $totalSalesToday : 0; + @endphp + +
Dashboard Overview
-
+
+
+
+
+
+
+ +
+
+
+
Total Sales Today
+
${{ number_format($totalSalesAmountToday, 2) }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Orders Today
+
{{ $totalSalesToday }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Customers
+
{{ $totalCustomers }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Total Revenue This Month
+
${{ number_format($totalRevenueThisMonth, 2) }}
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Average Order Value
+
${{ number_format($averageOrderValue, 2) }}
+
+
+
+
+
+ +
+
+
+ + + @php + // Import necessary classes + //use Carbon\Carbon; + + // Fetch recent orders (last 10) + $recentOrders = DB::table('Orders') + ->orderBy('created_at', 'desc') + ->take(10) + ->get(); + + // Fetch top-selling products + $topSellingProducts = DB::table('Orders') + ->select('ProductId', DB::raw('SUM(ProductQty) as total_quantity')) + ->groupBy('ProductId') + ->orderBy('total_quantity', 'desc') + ->take(5) + ->get(); + + // Fetch abandoned carts + //$abandonedCarts = DB::table('Carts') + //->where('status', 'abandoned') + // ->count(); + + // Fetch pending orders + $pendingOrders = DB::table('Orders') + ->where('Status', 'pending') + ->count(); + @endphp + + +
Sales and Order Management
+
+
+
+ +
@@ -20,15 +168,15 @@
-
Profile Views
-
112.000
+
Recent Orders (Last 10)
+
{{ $recentOrders->count() }}
-
+
@@ -38,15 +186,15 @@
-
Followers
-
183.000
+
Top Selling Products
+
{{ $topSellingProducts->sum('total_quantity') }}
-
+
@@ -56,15 +204,15 @@
-
Following
-
80.000
+
Abandoned Carts
+
-
+
@@ -74,8 +222,8 @@
-
Saved Post
-
112
+
Pending Orders
+
{{ $pendingOrders }}
@@ -83,9 +231,10 @@
- - + + +
diff --git a/resources/views/userTemp/layout/layout.blade.php b/resources/views/userTemp/layout/layout.blade.php index e4be57e..2ad5bbd 100644 --- a/resources/views/userTemp/layout/layout.blade.php +++ b/resources/views/userTemp/layout/layout.blade.php @@ -2,303 +2,283 @@ - - - - - - - - - Eflyer - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + Eflyer + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + -@if (Route::has('login')) - @auth - @php - // Retrieve the authenticated user's role - $user = Auth::user(); - $roleId = DB::table('role_user')->where('user_id', $user->id)->value('role_id'); - $cardProductCount = DB::table('cards')->sum('product_qty'); - - @endphp - - - - + + + + + @yield('main') - - + + + - - - - - - - - - - - - + + + + + + + + + + + - - - + + + - + function closeNav() { + document.getElementById("mySidenav").style.width = "0"; + } + - - - + + diff --git a/resources/views/userTemp/model.blade.php b/resources/views/userTemp/model.blade.php index 72ea32d..7c215dc 100644 --- a/resources/views/userTemp/model.blade.php +++ b/resources/views/userTemp/model.blade.php @@ -2,7 +2,7 @@