Skip to content
Open

. #1

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
308 commits
Select commit Hold shift + click to select a range
9183a79
routing untuk delivery addreess
naaasruul Apr 21, 2025
08f49d0
fix spacing
naaasruul Apr 22, 2025
34a4133
add profile controller
naaasruul Apr 22, 2025
ea6134e
tambah table phone_number
naaasruul Apr 22, 2025
b6dd3c4
refactor modal and make a dynamic phone number
naaasruul Apr 22, 2025
597c7eb
tukar color
naaasruul Apr 22, 2025
24ada18
tukar color
naaasruul Apr 22, 2025
d80b3c8
seeder enhancemnets
naaasruul Apr 22, 2025
429f906
update email addresses in UserSeeder for admin and seller users
naaasruul Apr 22, 2025
29fdb7c
admin manage-buyer
naaasruul Apr 22, 2025
ecb746c
fixed
naaasruul Apr 22, 2025
db326f3
update register user
naaasruul Apr 25, 2025
df8397f
update user seeder
naaasruul Apr 25, 2025
e826c50
test
naaasruul Apr 25, 2025
a7f90ce
add clockwork
claymor333 Apr 25, 2025
1ca8fbd
Merge branch 'main' of https://github.com/naaasruul/nadiSwap
claymor333 Apr 25, 2025
d639991
updated sidebar item
naaasruul Apr 25, 2025
c4ce95b
add CategoryController, Category model, migration, and categories view
naaasruul Apr 25, 2025
c15147c
add Categories route and sidebar item for sellers
naaasruul Apr 25, 2025
c14d486
Merge branch 'main' of https://github.com/naaasruul/flowbite-app
naaasruul Apr 25, 2025
af6a14f
category preference algo
claymor333 Apr 25, 2025
c72c84a
reccomendation algorithm
claymor333 Apr 25, 2025
82aaff2
recommendation algorithm
claymor333 Apr 25, 2025
4c3e473
product seeder
claymor333 Apr 25, 2025
c840b03
buyer user seeder
claymor333 Apr 25, 2025
46fd0bc
create categories and display pn category page
naaasruul Apr 27, 2025
2a6e81c
time add review, nanti categorynya bboleh diselect by apa yang dia add
naaasruul Apr 27, 2025
48d737e
add edit delete for category
naaasruul Apr 27, 2025
1a974bd
Enhance product management interface with export functionality and im…
naaasruul Apr 28, 2025
8dd77b1
Refactor product update validation and enhance product listing layout…
naaasruul Apr 28, 2025
728b4f1
function to add shipping review completed
naaasruul Apr 28, 2025
9dd2f60
CRUD for Shipping fee
naaasruul Apr 28, 2025
a7c9573
Merge branch 'main' of https://github.com/naaasruul/nadiSwap into random
claymor333 Apr 29, 2025
e57e86e
Implement Order management features with CRUD operations and enhance …
naaasruul Apr 29, 2025
ea83d6d
Refactor product listing to show only seller's products and implement…
naaasruul Apr 29, 2025
d636c91
Add orders resource route for seller management
naaasruul Apr 29, 2025
65503e6
GIANT REFACTOR OF PREFERENCE ALGORITHM
claymor333 Apr 29, 2025
4386798
add relationships
claymor333 Apr 29, 2025
10fd7b4
add relationships
claymor333 Apr 29, 2025
5b6377f
modify factory to use category_id
claymor333 Apr 29, 2025
8e446a3
debugging
claymor333 Apr 29, 2025
7b739bb
modify web
claymor333 Apr 29, 2025
9fba43c
search histories table
claymor333 Apr 29, 2025
36f2d10
use migration created by artisan instead of relying on created ones s…
claymor333 Apr 29, 2025
ef13004
add category_id and drop category
claymor333 Apr 29, 2025
fbe8b86
use category_id instead of category in ucp
claymor333 Apr 29, 2025
ae367f1
category seeder
claymor333 Apr 29, 2025
4426cd5
old buyer dashboard
claymor333 Apr 29, 2025
4b098c8
new buyer dashboard
claymor333 Apr 29, 2025
25d0167
Implement payment and delivery status update functionality for orders
naaasruul Apr 29, 2025
2881d86
order completed
naaasruul Apr 29, 2025
e7483db
re add show account and reset button also resets search history
claymor333 Apr 29, 2025
2d4977b
Implement review management features for sellers, including viewing, …
naaasruul Apr 29, 2025
361f424
Add 'response' field to fillable attributes in Review model
naaasruul Apr 29, 2025
e4c0cc9
Add 'response' field to reviews table migration
naaasruul Apr 29, 2025
749cab9
Update sidebar route for reviews to use correct path
naaasruul Apr 29, 2025
946f07b
Add reviews management view with response functionality for sellers
naaasruul Apr 29, 2025
b1c14f4
Add reviews resource routes and response functionality for sellers
naaasruul Apr 29, 2025
1c30cdf
too much changes i forgot
claymor333 Apr 29, 2025
308cb87
show all even after recommended
claymor333 Apr 29, 2025
0e30d3a
adjust cart controller
claymor333 Apr 29, 2025
9253731
paginator
claymor333 Apr 29, 2025
29b8493
adjust category badge on product card
claymor333 Apr 29, 2025
396c584
adjust cart logic
claymor333 Apr 29, 2025
42f0e93
move into respective role group
claymor333 Apr 29, 2025
a3f6dd0
profile avatar uploading (BASIC)
claymor333 Apr 29, 2025
c37144e
Add report generation functionality for sellers with sales data visua…
naaasruul Apr 30, 2025
5970fb2
tidy
claymor333 Apr 30, 2025
97cca82
Merge branch 'main' of https://github.com/naaasruul/nadiSwap into buy…
claymor333 Apr 30, 2025
0e70f89
Remove unused div for pie chart in sales report view
naaasruul Apr 30, 2025
937f46c
Merge branch 'main' of https://github.com/naaasruul/flowbite-app
naaasruul Apr 30, 2025
8363fc1
Merge branch 'main' of https://github.com/naaasruul/nadiSwap into random
claymor333 Apr 30, 2025
68dde8d
delete selection
naaasruul Apr 30, 2025
ef2c9ad
add better UI
naaasruul Apr 30, 2025
40ebe13
Merge branch 'random'
claymor333 Apr 30, 2025
26890c6
hotfix
claymor333 Apr 30, 2025
dca1012
add errors and improve UX
claymor333 Apr 30, 2025
15e1f31
use readonly instead of disabled due to form requirements
claymor333 Apr 30, 2025
33150ba
Implement multi-image upload for products and update related views an…
naaasruul Apr 30, 2025
e9bb7a0
Merge branch 'main' of https://github.com/naaasruul/flowbite-app
naaasruul Apr 30, 2025
7446b78
layout
claymor333 Apr 30, 2025
dbfc6c3
Merge branch 'main' of https://github.com/naaasruul/nadiSwap
claymor333 Apr 30, 2025
beb3447
now in json formatting
claymor333 Apr 30, 2025
486ee12
decode json, use first image in array as thumbnail
claymor333 Apr 30, 2025
fd22dfa
use asset
claymor333 Apr 30, 2025
06f93b5
image carousel
claymor333 Apr 30, 2025
acea14d
Refactor product category handling: update validation, model, and vie…
naaasruul Apr 30, 2025
e10b70d
cart use json object 0 for images
claymor333 Apr 30, 2025
50bbf1a
Add ListOrder, Rating, and Transaction controllers with basic CRUD me…
naaasruul Apr 30, 2025
8f469df
Refactor UI components: update color scheme to use pink accents acros…
naaasruul Apr 30, 2025
18abbc7
add seller id
claymor333 Apr 30, 2025
2749227
logging, add functionalities to cart index and hotfix index view retu…
claymor333 Apr 30, 2025
cb2ad5f
modification migration for shippings table
claymor333 Apr 30, 2025
97ec06c
Merge branch 'hotfix2'
claymor333 Apr 30, 2025
bb03263
Refactor admin controllers and views to enhance order, rating, and tr…
naaasruul May 1, 2025
effbe4d
Remove order status assignment and update button styles in cart view
naaasruul May 1, 2025
4282201
Enhance checkout process: update cart quantities from JSON input, cal…
claymor333 May 2, 2025
1a8d023
add success
claymor333 May 2, 2025
55c6749
Enhance cart functionality: add delivery address selection, update sh…
claymor333 May 2, 2025
996838d
comment category filter
claymor333 May 2, 2025
8912cb1
add buttons to headers
claymor333 May 2, 2025
bb5a1c3
contact page
claymor333 May 2, 2025
bbfc357
add product category filter on header
claymor333 May 2, 2025
8ea5f74
add contact page
claymor333 May 2, 2025
667e31f
invoice page
claymor333 May 2, 2025
af319d2
update order listy
claymor333 May 2, 2025
be87928
update order list
claymor333 May 2, 2025
65f3250
renaem
claymor333 May 2, 2025
7b22a8c
add invoice route
claymor333 May 2, 2025
6ed24d0
mailtrap mailing from contact us form
claymor333 May 2, 2025
23de7ae
encode cart items after checkout
naaasruul May 3, 2025
95953ce
decode data cart items dulu
naaasruul May 3, 2025
aac74e8
add seller id when create shipping
naaasruul May 3, 2025
7f453e9
decode cart items
naaasruul May 3, 2025
566c080
tukar color kepada pink
naaasruul May 3, 2025
ecd1e3d
buang border sebab buruk
naaasruul May 3, 2025
ebd4265
pun tukar color ke pink
naaasruul May 3, 2025
e2d702c
tukar warna border dan fokus kepada pink dalam borang hubungan
naaasruul May 3, 2025
6b8283d
buang karakter tidak perlu dalam laporan penjualan
naaasruul May 3, 2025
fe7f3ab
add env example
naaasruul May 5, 2025
8d80340
product can be add with decimal number
naaasruul May 5, 2025
aee204d
RESET PASSWORD SIAP !
naaasruul May 5, 2025
5f71cb1
configure data with log it says ok je
naaasruul May 5, 2025
81b67d4
installing stripe
naaasruul May 5, 2025
a99b40c
set email, phone number, unique and password validation dhould be bet…
naaasruul May 6, 2025
9440671
display any errors
naaasruul May 6, 2025
9e6e760
header user selain buyer takde item yg berkaitan
naaasruul May 6, 2025
296f1dd
not allowed user when id mode seller / admin
naaasruul May 6, 2025
66a6e87
refactor checkout process to handle file receipt upload and improve e…
naaasruul May 6, 2025
1b355f3
add file_receipt to Order model fillable attributes
naaasruul May 6, 2025
ece11dc
add file_receipt column to orders table migration
naaasruul May 6, 2025
d4b8efe
add file receipt upload functionality to checkout form
naaasruul May 6, 2025
5c8177e
add receipt column and display functionality to orders table
naaasruul May 6, 2025
a0b4160
fix: remove redundant border class from reviews table
naaasruul May 6, 2025
8226aa0
kasi nampak button add review ni, kita bg bg color
naaasruul May 6, 2025
cb79215
display invoice details
naaasruul May 6, 2025
719b16b
display shipping fee
naaasruul May 6, 2025
e047ca5
no qr
naaasruul May 6, 2025
1ab55f9
logic error
naaasruul May 6, 2025
469a269
lol
naaasruul May 6, 2025
24d0303
asds
naaasruul May 6, 2025
2b995e5
show products with stock >0
claymor333 May 7, 2025
ceebdf6
better carousel buttons
claymor333 May 7, 2025
308ec42
fix small main image focus
claymor333 May 7, 2025
6e7e138
quantity limit warning by checking the stock when attempting to add t…
claymor333 May 7, 2025
fb850b6
cart submit instead of button
claymor333 May 7, 2025
b3fbf96
restrict cart quantity selection
claymor333 May 7, 2025
1e98893
cart controller stock-quantity limit
claymor333 May 7, 2025
0d3ec9f
href addresses
claymor333 May 7, 2025
7fb72a9
stock-quantity limit
claymor333 May 7, 2025
e3b722f
regex untuk symbol 1 huruf besaq punya validation
naaasruul May 7, 2025
47a4654
tukaq shipping total hanya untuk 1 ordaq sahaja
naaasruul May 7, 2025
13255a7
imporve UI
naaasruul May 7, 2025
7110fb9
updted
naaasruul May 7, 2025
5768596
add seller information to cart items and include shipping options
naaasruul May 7, 2025
335929e
add BankAccount management functionality with create and store methods
naaasruul May 7, 2025
2bfb5c5
add bankAccount relationship to User model
naaasruul May 7, 2025
67c09fe
add migration for bank_accounts table with foreign key to sellers
naaasruul May 7, 2025
a0954f9
fix: update order items display to handle JSON format and improve emp…
naaasruul May 7, 2025
c993d71
fix: update image source paths in cart views and display seller bank …
naaasruul May 7, 2025
36eb121
add: include bank account navigation for sellers and define bank acco…
naaasruul May 7, 2025
421fb98
updated
naaasruul May 14, 2025
275d696
updated
naaasruul May 14, 2025
448c9de
updated
naaasruul May 14, 2025
db8a8f3
seller takle upload review done
naaasruul May 21, 2025
61d94e9
updated
naaasruul May 21, 2025
8e00b23
client taknak tunjuk review untk seller sebba dah ada page seller.
naaasruul May 24, 2025
64b0872
show bank accoumnt
naaasruul May 24, 2025
debd7e7
fix: seeder pathing for images
claymor333 May 28, 2025
fecb6ba
fix: header buttons failing to react upon logging in
claymor333 May 28, 2025
3f5bf2b
feat: add numbering
claymor333 May 28, 2025
a8056bb
feat: date
claymor333 May 28, 2025
b18e8cb
feat: make searchable, add numbering, add date formatiing
claymor333 May 28, 2025
e2e6fc1
belh
claymor333 May 28, 2025
ee71d3e
feat: new seeders
claymor333 May 28, 2025
42393a4
feat: add login check
claymor333 May 28, 2025
1c5a291
formatting, GRAMMAR: changed ood (out of delivery) to ofd (out for de…
claymor333 May 28, 2025
ff9c8ff
feat: Add order status update functionality
claymor333 May 28, 2025
c7504f4
feat: add order status
claymor333 May 28, 2025
a1c75a1
fix: product seeder, only seller has product
claymor333 May 28, 2025
02950cf
feat: multiple shipping addresses
claymor333 May 28, 2025
36121cd
feat: update order status
claymor333 May 28, 2025
4ae749b
feat: new icons
claymor333 May 28, 2025
b697ff8
feat: add update order status js
claymor333 May 28, 2025
c7bacd4
feat: admin order data table with filtering, search and per page sele…
claymor333 May 28, 2025
e4ad6eb
feat: add order status col and badge cllasses, use datatable js
claymor333 May 28, 2025
c8ef266
feat: login redirect if attempting to add an item to cart if not authed
claymor333 May 28, 2025
b14fedf
feat: add order status, select pending if the user has not committed …
claymor333 May 28, 2025
ee923a4
fix: MAKE ALL REDIRECTS SO THINGS ACTUALLY LOAD FOR ONCE GOD!!!
claymor333 May 30, 2025
bb9e991
feat: controller methods
claymor333 May 30, 2025
1ac8439
feat: changes
claymor333 May 30, 2025
4136b5f
feat: order dropdown items
claymor333 May 30, 2025
74d0964
feat: order dropdowns views and js datatables
claymor333 May 30, 2025
fd8afd6
sdfdsfdsf
claymor333 May 30, 2025
e53bb9d
fix: no hover
claymor333 Jun 3, 2025
5aab00f
feat: buyer can check order info and request cancel
claymor333 Jun 3, 2025
71339df
feat: formatting and order info cotnroller, get all latest orders ins…
claymor333 Jun 3, 2025
3815298
feat: order cancellations
claymor333 Jun 3, 2025
4ea2ee0
feat: seller cancel order and check order details
claymor333 Jun 4, 2025
50d6343
feat: fetch orders, cancelled and vice versa with pagination
claymor333 Jun 4, 2025
1503d70
feat: first name last name, avi upload
claymor333 Jun 4, 2025
2664792
fix: consistent layout
claymor333 Jun 4, 2025
1c338fd
feat: added fields
claymor333 Jun 4, 2025
e09be9d
feat: add actions and cancelled orders
claymor333 Jun 4, 2025
d0cb20c
feat: order info for seller
claymor333 Jun 4, 2025
2f64e2f
feat: order cancellations
claymor333 Jun 4, 2025
1e55cac
feat: dont navigate so sidebar dropdowns functions
claymor333 Jun 4, 2025
92c074e
feat: add and remove buttons
claymor333 Jun 4, 2025
63e6801
feat: separate sold and unsold, no operations on sold items
claymor333 Jun 5, 2025
3bb7cb5
feat: select bank accounts
claymor333 Jun 5, 2025
bce9842
feat: qol
claymor333 Jun 5, 2025
ae735b3
feat: remove unneeded
claymor333 Jun 6, 2025
f9bc24b
feat: qol
claymor333 Jun 6, 2025
bee6cac
feat: fix black backdrop on modals
claymor333 Jun 6, 2025
d7a2c63
feat: make layout consistent
claymor333 Jun 6, 2025
95e8d32
feat: add phone number and name
claymor333 Jun 6, 2025
82f1222
feat: delete useless
claymor333 Jun 6, 2025
006169b
feat: add routing
claymor333 Jun 6, 2025
cd5697f
feat; make categories searchable
claymor333 Jun 6, 2025
4ba4cd7
feat: seller order views
claymor333 Jun 6, 2025
58df43a
feat: remove useless
claymor333 Jun 6, 2025
6ba22ea
feat: make reviews searchable
claymor333 Jun 6, 2025
9c74e49
feat: qol
claymor333 Jun 6, 2025
b1590ea
feat: make dark mode compatible
claymor333 Jun 6, 2025
813a5d5
feat: no avatar placeholders
claymor333 Jun 6, 2025
181d8f7
feat: buyer information
claymor333 Jun 6, 2025
52886eb
fix: naming
claymor333 Jun 6, 2025
6fa566e
feat: fix
claymor333 Jun 6, 2025
fde66c3
feat: edit products now matches create products, allow removing image…
claymor333 Jun 8, 2025
c4db446
feat: use flux input and use username as avatar name
claymor333 Jun 8, 2025
f507642
fix
claymor333 Jun 8, 2025
f72b329
feat: only cancelled orders
claymor333 Jun 8, 2025
d1b9502
feat: reorganize
claymor333 Jun 8, 2025
3909df0
feat: buyer orders table page
claymor333 Jun 8, 2025
f545288
feat: deprecate account profile and use livewire settings
claymor333 Jun 8, 2025
4995244
feat: layouting
claymor333 Jun 8, 2025
ee6efdf
featl replacement views for account-profile
claymor333 Jun 8, 2025
1fcc124
fix: make address line 2 updatable
claymor333 Jun 8, 2025
45771ad
feat: larger address info
claymor333 Jun 8, 2025
c6d5079
hotfix
claymor333 Jun 12, 2025
3321b57
feat: with cancelled Order
claymor333 Jun 13, 2025
215b44e
feat: update all fields
claymor333 Jun 13, 2025
fc56dbd
feat: separate orders and addresses
claymor333 Jun 13, 2025
83bb9a7
feat: separated routings
claymor333 Jun 13, 2025
b483b33
feat: hotfix, show cancelled order details
claymor333 Jun 13, 2025
ec2076f
feat: cancel only when order and payment status pending
claymor333 Jun 13, 2025
af68a41
fix: remove redundant and add update to controller
claymor333 Jun 15, 2025
4b15ae3
Update reviews-table.js
claymor333 Jun 18, 2025
af9a091
feat: revamp edit modal
claymor333 Jun 19, 2025
0bb5047
feat: fix
claymor333 Jun 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions app/Http/Controllers/Admin/ListOrderController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Order;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class ListOrderController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
$orders = Order::all();
return view('admin.orders',compact('orders'));
}

public function paymentStatusIndex()
{
//
$orders = Order::all();
return view('admin.payment-orders',compact('orders'));
}

public function deliveryStatusIndex()
{
//
$orders = Order::all();
return view('admin.delivery-orders',compact('orders'));
}

public function orderStatusIndex()
{
//
$orders = Order::all();
return view('admin.status-orders',compact('orders'));
}

public function showDelivery(Order $order)
{
Log::info('Showing delivery for order: ' . $order->id);

$cancelledOrder = $order->cancellation()->latest()->first();
return view('admin.delivery-order-info',compact('order', 'cancelledOrder'));
}

public function showPayment(Order $order)
{
Log::info('Showing delivery for order: ' . $order->id);

$cancelledOrder = $order->cancellation()->latest()->first();
return view('admin.payment-order-info',compact('order', 'cancelledOrder'));
}

public function showOrderStatus(Order $order)
{
Log::info('Showing delivery for order: ' . $order->id);

$cancelledOrder = $order->cancellation()->latest()->first();
return view('admin.status-order-info',compact('order', 'cancelledOrder'));
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
69 changes: 69 additions & 0 deletions app/Http/Controllers/Admin/RatingController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Review;
use Illuminate\Http\Request;

class RatingController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
// Retrieve reviews for products that belong to the seller
$reviews = Review::all();
return view('admin.ratings',compact('reviews'));
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
69 changes: 69 additions & 0 deletions app/Http/Controllers/Admin/TransactionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Order;
use Illuminate\Http\Request;

class TransactionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
$orders = Order::all();

return view('admin.transactions', compact('orders'));
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
131 changes: 131 additions & 0 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?php

namespace App\Http\Controllers;

use App\Models\Order;
use App\Models\Product;
use App\Models\Review;
use App\Models\User;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;

class AdminController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
$users = User::all();
$orders = Order::all();
$products = Product::all();
$reviews = Review::all();

$sellers = User::role('seller')->get(); // Fetch all sellers
$buyers = User::role('buyer')->get(); // Fetch all buyers
$admins = User::role('admin')->get(); // Fetch all admins

$buyersCount = $buyers->count();
$sellersCount = $sellers->count();

// Group transactions by day and count them
$transactions = Order::selectRaw('DATE(created_at) as date, COUNT(*) as count')
->groupBy('date')
->orderBy('date', 'ASC')
->get();

// Prepare data for the chart
$transactionDates = $transactions->pluck('date')->map(function ($date) {
return \Carbon\Carbon::parse($date)->format('d F'); // Format date as '01 February'
});
$transactionCounts = $transactions->pluck('count');

// Calculate order statuses
$pendingOrders = Order::where('payment_status', 'pending')->count();
$paidOrders = Order::where('payment_status', 'paid')->count();
$cancelledOrders = Order::where('payment_status', 'cancelled')->count();


return view('admin.dashboard',compact(
'users',
'orders',
'products',
'reviews',
'sellers',
'buyers',
'admins',
'buyersCount',
'sellersCount',
'transactionDates',
'transactionCounts',
'pendingOrders',
'paidOrders',
'cancelledOrders'
));
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}

public function showManageSeller()
{
// Show the manage seller view
// You can pass any data to the view if needed
$sellers = User::role('seller')->get(); // Fetch all sellers
return view('admin.manage-seller',compact('sellers'));
}

public function showManageBuyer()
{
// Show the manage buyer view
// You can pass any data to the view if needed
$buyers = User::role('buyer')->get(); // Fetch all buyers
return view('admin.manage-buyer',compact('buyers'));
}
}
Loading