From 5f477c03d0240d73c054dd47af82fe446ddab7ad707af3c8d81bdacb2cd94079 Mon Sep 17 00:00:00 2001 From: Abhishek Mali Date: Wed, 12 Nov 2025 19:44:04 +0530 Subject: [PATCH] order list update --- .../Admin/AdminOrderController.php | 16 ++- resources/views/admin/dashboard.blade.php | 43 +++++-- resources/views/admin/layouts/app.blade.php | 5 +- resources/views/admin/orders_show.blade.php | 109 ++++++++++++++++++ routes/web.php | 5 +- 5 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 resources/views/admin/orders_show.blade.php diff --git a/app/Http/Controllers/Admin/AdminOrderController.php b/app/Http/Controllers/Admin/AdminOrderController.php index d467825..827bd9d 100644 --- a/app/Http/Controllers/Admin/AdminOrderController.php +++ b/app/Http/Controllers/Admin/AdminOrderController.php @@ -59,10 +59,20 @@ class AdminOrderController extends Controller return redirect()->back()->with('success', 'Order created successfully with ID: ' . $newOrderId); } - public function show($id) { - $order = Order::findOrFail($id); - return view('admin.orders_show', compact('order')); + $order = Order::with('markList')->findOrFail($id); + + // Get the mark list associated with this order + $markList = $order->markList; + + // Fetch the user using the customer_id from mark list + $user = null; + if ($markList && $markList->customer_id) { + $user = \App\Models\User::where('customer_id', $markList->customer_id)->first(); + } + + return view('admin.orders_show', compact('order', 'markList', 'user')); } + } diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 0359d50..4d1be8f 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -1,6 +1,6 @@ @extends('admin.layouts.app') -@section('page-title', 'Orders') +@section('page-title', 'Dashboard') @section('content')
@@ -78,14 +78,14 @@
- {{-- Orders Table --}} + {{-- Recent Orders Table --}}
Recent Orders
- - +
+ @@ -93,7 +93,17 @@ - + + + + + + + + + + + @@ -102,24 +112,39 @@ @forelse($orders as $index => $order) - - + + + + + + + + + + + + - + @empty - + @endforelse
# Order IDDescription Origin DestinationTTL AmountCTNQTYTTL/QTYUnitPrice (₹)TTL Amount (₹)CBMTTL CBMKGTTL KGShop No Status Date Action
{{ $index + 1 }}{{ $order->order_id }}{{ $order->id }}{{ $order->order_id }} {{ $order->mark_no }} {{ $order->description }} {{ $order->origin }} {{ $order->destination }}{{ $order->ctn }}{{ $order->qty }}{{ $order->ttl_qty }}{{ $order->unit }}₹{{ number_format($order->price, 2) }} ₹{{ number_format($order->ttl_amount, 2) }}{{ $order->cbm }}{{ $order->ttl_cbm }}{{ $order->kg }}{{ $order->ttl_kg }}{{ $order->shop_no }} {{ ucfirst($order->status) }} {{ $order->created_at->format('d-m-Y') }}View + + View + +
No orders found
No orders found
+ {{-- Autofill JS --}} diff --git a/resources/views/admin/layouts/app.blade.php b/resources/views/admin/layouts/app.blade.php index b4fa47f..24a0dbd 100644 --- a/resources/views/admin/layouts/app.blade.php +++ b/resources/views/admin/layouts/app.blade.php @@ -179,10 +179,11 @@ Customers Reports Chat Support - Orders - + --> + Orders Requests Staff Account diff --git a/resources/views/admin/orders_show.blade.php b/resources/views/admin/orders_show.blade.php new file mode 100644 index 0000000..1aa40da --- /dev/null +++ b/resources/views/admin/orders_show.blade.php @@ -0,0 +1,109 @@ +@extends('admin.layouts.app') + +@section('page-title', 'Order Details') + +@section('content') +
+ + {{-- Header --}} +
+
+
+
+

Orders Details

+ Detailed view of all orders in this shipment consolidation. +
+ +
+ +
+ + {{-- Customer Info --}} +
+
+
+
+ {{ strtoupper(substr($user->customer_name ?? 'U', 0, 1)) }} +
+
+
+
{{ $user->customer_name ?? 'Unknown Customer' }}
+

{{ $user->company_name ?? 'N/A' }}

+

{{ $user->email ?? '' }}

+

{{ $user->mobile_no ?? '' }}

+
+
+
+

{{ $user->address ?? '' }}

+ {{ $user->pincode ?? '' }} +
+
+ + {{-- Order Summary --}} +
+
+
+

Order ID

+
{{ $order->order_id }}
+
+
+

Total Orders

+
{{ 1 }}
+
+
+

Status

+ {{ ucfirst($order->status) }} +
+
+
+ + {{-- Order Table --}} +
+ + + + + + + + + + + + + + + + + + + + + + + +
Item NoDescriptionCTNQTYTTL/QTYUnitAmount (₹)
{{ $order->mark_no }}{{ $order->description }}{{ $order->ctn }}{{ $order->qty }}{{ $order->ttl_qty }}{{ $order->unit }}₹{{ number_format($order->ttl_amount, 2) }}
+
+ + {{-- Totals --}} +
+
+
{{ $order->ttl_qty }}
+ Total TTL/QTY +
+
+
{{ $order->ttl_kg }}
+ Total TTL KG +
+
+
₹{{ number_format($order->ttl_amount, 2) }}
+ Total Amount +
+
+ +
+
+ +
+@endsection diff --git a/routes/web.php b/routes/web.php index a12faa6..c9958fe 100644 --- a/routes/web.php +++ b/routes/web.php @@ -34,7 +34,7 @@ Route::prefix('admin')->middleware('auth:admin')->group(function () { Route::get('/customers', fn() => view('admin.customers'))->name('admin.customers'); Route::get('/reports', fn() => view('admin.reports'))->name('admin.reports'); Route::get('/chat-support', fn() => view('admin.chat_support'))->name('admin.chat_support'); - Route::get('/orders', fn() => view('admin.orders'))->name('admin.orders'); + Route::get('/staff', fn() => view('admin.staff'))->name('admin.staff'); Route::get('/account', fn() => view('admin.account'))->name('admin.account'); Route::get('/profile', fn() => view('admin.profile'))->name('admin.profile'); @@ -50,8 +50,9 @@ Route::prefix('admin')->middleware('auth:admin')->group(function () { Route::get('/mark-list', [AdminMarkListController::class, 'index'])->name('admin.marklist.index'); Route::get('/mark-list/status/{id}', [AdminMarkListController::class, 'toggleStatus'])->name('admin.marklist.toggle'); + Route::get('/orders', fn() => view('admin.orders'))->name('admin.orders'); // Orders Controller Routes - Route::get('/orders', [AdminOrderController::class, 'index'])->name('admin.orders.index'); + Route::get('/orders/list', [AdminOrderController::class, 'index'])->name('admin.orders.index'); Route::post('/orders/store', [AdminOrderController::class, 'store'])->name('admin.orders.store'); Route::get('/orders/{id}', [AdminOrderController::class, 'show'])->name('admin.orders.show');