Files
Kent-logistics-Laravel/resources/views/admin/customers_view.blade.php
2025-11-18 10:01:59 +05:30

180 lines
6.4 KiB
PHP

@extends('admin.layouts.app')
@section('page-title', 'Customer Details')
@section('content')
<div class="container py-4">
{{-- HEADER --}}
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold">Customer Details</h3>
<a href="{{ route('admin.customers.index') }}" class="btn btn-secondary">
<i class="bi bi-arrow-left"></i> Back
</a>
</div>
{{-- CUSTOMER CARD --}}
<div class="card shadow-sm mb-4">
<div class="card-body">
<div class="d-flex align-items-center mb-3">
{{-- Avatar --}}
<div class="rounded-circle bg-primary text-white d-flex align-items-center justify-content-center me-3"
style="width:70px; height:70px; font-size:28px; font-weight:bold;">
{{ strtoupper(substr($customer->customer_name,0,1)) }}
</div>
<div>
<h4 class="mb-0">{{ $customer->customer_name }}</h4>
<div class="text-muted">{{ $customer->company_name }}</div>
{{-- Customer Type --}}
@if($customer->customer_type == 'premium')
<span class="badge bg-purple mt-2">Premium Customer</span>
@else
<span class="badge bg-secondary mt-2">Regular Customer</span>
@endif
</div>
<div class="ms-auto">
{{-- Status --}}
@if($customer->status == 'active')
<span class="badge bg-success p-2">Active</span>
@else
<span class="badge bg-danger p-2">Inactive</span>
@endif
</div>
</div>
{{-- BASIC INFO --}}
<hr>
<div class="row">
<div class="col-md-6">
<h6 class="text-uppercase text-muted">Contact Information</h6>
<p class="mb-1"><strong>Email:</strong> {{ $customer->email }}</p>
<p class="mb-1"><strong>Mobile:</strong> {{ $customer->mobile_no }}</p>
<p class="mb-1"><strong>Address:</strong> {{ $customer->address }}</p>
<p class="mb-1"><strong>Pincode:</strong> {{ $customer->pincode }}</p>
</div>
<div class="col-md-6">
<h6 class="text-uppercase text-muted">Account Information</h6>
<p class="mb-1"><strong>Customer ID:</strong> {{ $customer->customer_id }}</p>
<p class="mb-1"><strong>Registered On:</strong>
{{ $customer->created_at ? $customer->created_at->format('d-m-Y') : '-' }}
</p>
<p class="mb-1"><strong>Designation:</strong>
{{ $customer->designation ?? 'N/A' }}</p>
</div>
</div>
</div>
</div>
{{-- STATISTICS --}}
<div class="row mb-4">
{{-- Total Orders --}}
<div class="col-md-4">
<div class="card shadow-sm">
<div class="card-body text-center">
<h5 class="fw-bold">{{ $totalOrders }}</h5>
<p class="text-muted mb-0">Total Orders</p>
</div>
</div>
</div>
{{-- Total Amount --}}
<div class="col-md-4">
<div class="card shadow-sm">
<div class="card-body text-center">
<h5 class="fw-bold">{{ number_format($totalAmount, 2) }}</h5>
<p class="text-muted mb-0">Total Amount Spent</p>
</div>
</div>
</div>
{{-- Mark Count --}}
<div class="col-md-4">
<div class="card shadow-sm">
<div class="card-body text-center">
<h5 class="fw-bold">{{ $customer->marks->count() }}</h5>
<p class="text-muted mb-0">Total Mark Numbers</p>
</div>
</div>
</div>
</div>
{{-- MARK LIST --}}
<div class="card shadow-sm mb-4">
<div class="card-header bg-light">
<strong>Customer Mark Numbers</strong>
</div>
<div class="card-body">
@if($customer->marks->count() == 0)
<p class="text-muted">No mark numbers found.</p>
@else
<ul class="list-group">
@foreach($customer->marks as $mark)
<li class="list-group-item">
<strong>{{ $mark->mark_no }}</strong>
<span class="text-muted">({{ $mark->origin }} {{ $mark->destination }})</span>
</li>
@endforeach
</ul>
@endif
</div>
</div>
<!-- {{-- RECENT ORDERS --}}
<div class="card shadow-sm mb-4">
<div class="card-header bg-light">
<strong>Recent Orders</strong>
</div>
<div class="card-body p-0">
@if($recentOrders->count() == 0)
<p class="p-3 text-muted">No recent orders found.</p>
@else
<table class="table table-bordered mb-0">
<thead>
<tr>
<th>Order ID</th>
<th>Mark No</th>
<th>Total Amount</th>
<th>Date</th>
<th>View</th>
</tr>
</thead>
<tbody>
@foreach($recentOrders as $o)
<tr>
<td>{{ $o->order_id }}</td>
<td>{{ $o->mark_no }}</td>
<td>{{ number_format($o->ttl_amount, 2) }}</td>
<td>{{ $o->created_at->format('d-m-Y') }}</td>
<td>
<a href="{{ route('admin.orders.show', $o->id) }}"
class="btn btn-sm btn-primary">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div> -->
</div>
@endsection