This commit is contained in:
Utkarsh Khedkar
2025-11-13 10:12:31 +05:30
5 changed files with 197 additions and 50 deletions

View File

@@ -59,10 +59,20 @@ class AdminOrderController extends Controller
return redirect()->back()->with('success', 'Order created successfully with ID: ' . $newOrderId); return redirect()->back()->with('success', 'Order created successfully with ID: ' . $newOrderId);
} }
public function show($id) public function show($id)
{ {
$order = Order::findOrFail($id); $order = Order::with('markList')->findOrFail($id);
return view('admin.orders_show', compact('order'));
// 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'));
}
} }

View File

@@ -1,6 +1,6 @@
@extends('admin.layouts.app') @extends('admin.layouts.app')
@section('page-title', 'Orders') @section('page-title', 'Dashboard')
@section('content') @section('content')
<style> <style>
@@ -168,8 +168,8 @@ body, .container-fluid { background: #f4f7fc; }
<div class="order-mgmt-main"> <div class="order-mgmt-main">
<!-- Create Order Form --> <!-- Create Order Form -->
<div id="createOrderForm" class="collapse mb-3"> <div id="createOrderForm" class="collapse mb-3">
<div class="card shadow-sm mb-4" style="margin-bottom:0!important;"> <div class="card">
<div class="card-header bg-light" style="border-radius:10px 10px 0 0;"><strong>New Order Form</strong></div> <div class="card-header bg-light"><strong>New Order Form</strong></div>
<div class="card-body"> <div class="card-body">
<form action="{{ route('admin.orders.store') }}" method="POST"> <form action="{{ route('admin.orders.store') }}" method="POST">
@csrf @csrf
@@ -208,12 +208,15 @@ body, .container-fluid { background: #f4f7fc; }
</div> </div>
</div> </div>
</div> </div>
<!-- Orders Table -->
<div class="card shadow-sm mb-2" style="box-shadow:none!important;border:none!important;"> {{-- Recent Orders Table --}}
<div class="card-header bg-light"><strong>Recent Orders</strong></div> <div class="card shadow-sm">
<div class="card-body table-responsive" style="padding-bottom:0;"> <div class="card-header bg-light">
<table class="table table-striped align-middle"> <strong>Recent Orders</strong>
<thead> </div>
<div class="card-body table-responsive">
<table class="table table-striped table-bordered align-middle text-center">
<thead class="table-light">
<tr> <tr>
<th>#</th> <th>#</th>
<th>Order ID</th> <th>Order ID</th>
@@ -221,7 +224,17 @@ body, .container-fluid { background: #f4f7fc; }
<th>Description</th> <th>Description</th>
<th>Origin</th> <th>Origin</th>
<th>Destination</th> <th>Destination</th>
<th>TTL Amount</th> <th>CTN</th>
<th>QTY</th>
<th>TTL/QTY</th>
<th>Unit</th>
<th>Price ()</th>
<th>TTL Amount ()</th>
<th>CBM</th>
<th>TTL CBM</th>
<th>KG</th>
<th>TTL KG</th>
<th>Shop No</th>
<th>Status</th> <th>Status</th>
<th>Date</th> <th>Date</th>
<th>Action</th> <th>Action</th>
@@ -230,26 +243,39 @@ body, .container-fluid { background: #f4f7fc; }
<tbody> <tbody>
@forelse($orders as $index => $order) @forelse($orders as $index => $order)
<tr> <tr>
<td>{{ $index + 1 }}</td> <td>{{ $order->id }}</td>
<td><a href="{{ route('admin.orders.show', $order->id) }}">{{ $order->order_id }}</a></td> <td><a href="{{ route('admin.orders.show', $order->id) }}" class="fw-semibold text-primary">{{ $order->order_id }}</a></td>
<td>{{ $order->mark_no }}</td> <td>{{ $order->mark_no }}</td>
<td>{{ $order->description }}</td> <td>{{ $order->description }}</td>
<td>{{ $order->origin }}</td> <td>{{ $order->origin }}</td>
<td>{{ $order->destination }}</td> <td>{{ $order->destination }}</td>
<td>{{ $order->ctn }}</td>
<td>{{ $order->qty }}</td>
<td>{{ $order->ttl_qty }}</td>
<td>{{ $order->unit }}</td>
<td>{{ number_format($order->price, 2) }}</td>
<td>{{ number_format($order->ttl_amount, 2) }}</td> <td>{{ number_format($order->ttl_amount, 2) }}</td>
<td>{{ $order->cbm }}</td>
<td>{{ $order->ttl_cbm }}</td>
<td>{{ $order->kg }}</td>
<td>{{ $order->ttl_kg }}</td>
<td>{{ $order->shop_no }}</td>
<td><span class="badge bg-info text-dark">{{ ucfirst($order->status) }}</span></td> <td><span class="badge bg-info text-dark">{{ ucfirst($order->status) }}</span></td>
<td>{{ $order->created_at->format('d-m-Y') }}</td> <td>{{ $order->created_at->format('d-m-Y') }}</td>
<td><a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">View</a></td> <td>
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i> View
</a>
</td>
</tr> </tr>
@empty @empty
<tr><td colspan="10" class="text-center">No orders found</td></tr> <tr><td colspan="20" class="text-center text-muted">No orders found</td></tr>
@endforelse @endforelse
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
<script> <script>
document.getElementById('markNoSelect').addEventListener('change', function() { document.getElementById('markNoSelect').addEventListener('change', function() {

View File

@@ -179,10 +179,11 @@
<a href="{{ route('admin.customers') }}" class="{{ request()->routeIs('admin.customers') ? 'active' : '' }}"><i class="bi bi-people"></i> Customers</a> <a href="{{ route('admin.customers') }}" class="{{ request()->routeIs('admin.customers') ? 'active' : '' }}"><i class="bi bi-people"></i> Customers</a>
<a href="{{ route('admin.reports') }}" class="{{ request()->routeIs('admin.reports') ? 'active' : '' }}"><i class="bi bi-graph-up"></i> Reports</a> <a href="{{ route('admin.reports') }}" class="{{ request()->routeIs('admin.reports') ? 'active' : '' }}"><i class="bi bi-graph-up"></i> Reports</a>
<a href="{{ route('admin.chat_support') }}" class="{{ request()->routeIs('admin.chat_support') ? 'active' : '' }}"><i class="bi bi-chat-dots"></i> Chat Support</a> <a href="{{ route('admin.chat_support') }}" class="{{ request()->routeIs('admin.chat_support') ? 'active' : '' }}"><i class="bi bi-chat-dots"></i> Chat Support</a>
<a href="{{ route('admin.orders.index') }}" <!-- <a href="{{ route('admin.orders.index') }}"
class="{{ request()->routeIs('admin.orders.*') ? 'active' : '' }}"> class="{{ request()->routeIs('admin.orders.*') ? 'active' : '' }}">
<i class="bi bi-bag"></i> Orders <i class="bi bi-bag"></i> Orders
</a> </a> -->
<a href="{{ route('admin.orders') }}" class="{{ request()->routeIs('admin.orders') ? 'active' : '' }}"><i class="bi bi-bag"></i> Orders</a>
<a href="{{ route('admin.requests') }}" class="{{ request()->routeIs('admin.requests') ? 'active' : '' }}"><i class="bi bi-envelope"></i> Requests</a> <a href="{{ route('admin.requests') }}" class="{{ request()->routeIs('admin.requests') ? 'active' : '' }}"><i class="bi bi-envelope"></i> Requests</a>
<a href="{{ route('admin.staff') }}" class="{{ request()->routeIs('admin.staff') ? 'active' : '' }}"><i class="bi bi-person-badge"></i> Staff</a> <a href="{{ route('admin.staff') }}" class="{{ request()->routeIs('admin.staff') ? 'active' : '' }}"><i class="bi bi-person-badge"></i> Staff</a>
<a href="{{ route('admin.account') }}" class="{{ request()->routeIs('admin.account') ? 'active' : '' }}"><i class="bi bi-gear"></i> Account</a> <a href="{{ route('admin.account') }}" class="{{ request()->routeIs('admin.account') ? 'active' : '' }}"><i class="bi bi-gear"></i> Account</a>

View File

@@ -0,0 +1,109 @@
@extends('admin.layouts.app')
@section('page-title', 'Order Details')
@section('content')
<div class="container py-4">
{{-- Header --}}
<div class="card shadow-sm rounded-3 border-0">
<div class="card-body">
<div class="d-flex justify-content-between align-items-start">
<div>
<h4 class="fw-bold mb-0">Orders Details</h4>
<small class="text-muted">Detailed view of all orders in this shipment consolidation.</small>
</div>
<a href="{{ route('admin.dashboard') }}" class="btn-close"></a>
</div>
<hr>
{{-- Customer Info --}}
<div class="row mb-4">
<div class="col-md-8 d-flex">
<div class="me-3">
<div class="rounded-circle bg-secondary text-white d-flex align-items-center justify-content-center"
style="width:60px; height:60px; font-size:20px;">
{{ strtoupper(substr($user->customer_name ?? 'U', 0, 1)) }}
</div>
</div>
<div>
<h5 class="mb-0">{{ $user->customer_name ?? 'Unknown Customer' }}</h5>
<p class="mb-0">{{ $user->company_name ?? 'N/A' }}</p>
<p class="mb-0 text-muted">{{ $user->email ?? '' }}</p>
<p class="mb-0 text-muted">{{ $user->mobile_no ?? '' }}</p>
</div>
</div>
<div class="col-md-4 text-end">
<p class="mb-0">{{ $user->address ?? '' }}</p>
<small class="text-muted">{{ $user->pincode ?? '' }}</small>
</div>
</div>
{{-- Order Summary --}}
<div class="bg-light rounded p-3 mb-3">
<div class="row text-center">
<div class="col-md-4 border-end">
<p class="fw-semibold mb-1">Order ID</p>
<h6 class="text-primary fw-bold">{{ $order->order_id }}</h6>
</div>
<div class="col-md-4 border-end">
<p class="fw-semibold mb-1">Total Orders</p>
<h6>{{ 1 }}</h6>
</div>
<div class="col-md-4">
<p class="fw-semibold mb-1">Status</p>
<span class="badge bg-warning text-dark">{{ ucfirst($order->status) }}</span>
</div>
</div>
</div>
{{-- Order Table --}}
<div class="table-responsive">
<table class="table table-bordered align-middle">
<thead class="table-light">
<tr>
<th>Item No</th>
<th>Description</th>
<th>CTN</th>
<th>QTY</th>
<th>TTL/QTY</th>
<th>Unit</th>
<th>Amount ()</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $order->mark_no }}</td>
<td>{{ $order->description }}</td>
<td>{{ $order->ctn }}</td>
<td>{{ $order->qty }}</td>
<td>{{ $order->ttl_qty }}</td>
<td>{{ $order->unit }}</td>
<td>{{ number_format($order->ttl_amount, 2) }}</td>
</tr>
</tbody>
</table>
</div>
{{-- Totals --}}
<div class="d-flex justify-content-between mt-3">
<div>
<h6 class="text-primary mb-0 fw-bold">{{ $order->ttl_qty }}</h6>
<small class="text-muted">Total TTL/QTY</small>
</div>
<div>
<h6 class="text-success mb-0 fw-bold">{{ $order->ttl_kg }}</h6>
<small class="text-muted">Total TTL KG</small>
</div>
<div class="text-end">
<h6 class="text-danger mb-0 fw-bold">{{ number_format($order->ttl_amount, 2) }}</h6>
<small class="text-muted">Total Amount</small>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -34,7 +34,7 @@ Route::prefix('admin')->middleware('auth:admin')->group(function () {
Route::get('/customers', fn() => view('admin.customers'))->name('admin.customers'); Route::get('/customers', fn() => view('admin.customers'))->name('admin.customers');
Route::get('/reports', fn() => view('admin.reports'))->name('admin.reports'); 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('/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('/staff', fn() => view('admin.staff'))->name('admin.staff');
Route::get('/account', fn() => view('admin.account'))->name('admin.account'); Route::get('/account', fn() => view('admin.account'))->name('admin.account');
Route::get('/profile', fn() => view('admin.profile'))->name('admin.profile'); 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', [AdminMarkListController::class, 'index'])->name('admin.marklist.index');
Route::get('/mark-list/status/{id}', [AdminMarkListController::class, 'toggleStatus'])->name('admin.marklist.toggle'); 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 // 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::post('/orders/store', [AdminOrderController::class, 'store'])->name('admin.orders.store');
Route::get('/orders/{id}', [AdminOrderController::class, 'show'])->name('admin.orders.show'); Route::get('/orders/{id}', [AdminOrderController::class, 'show'])->name('admin.orders.show');