customer section
This commit is contained in:
@@ -1,12 +1,176 @@
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('page-title', 'Dashboard')
|
||||
@section('page-title', 'Customers')
|
||||
|
||||
@section('content')
|
||||
|
||||
<style>
|
||||
.btn.active {
|
||||
opacity: 1 !important;
|
||||
border-width: 2px;
|
||||
}
|
||||
.btn {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #7c3aed !important;
|
||||
color: white !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<h4>Welcome to the Admin customer page</h4>
|
||||
<p>Here you can manage all system modules.</p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<h4 class="mb-3">Customer List</h4>
|
||||
|
||||
{{-- SEARCH + STATUS FILTER ROW --}}
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
|
||||
{{-- SEARCH BAR --}}
|
||||
<form method="GET" action="{{ route('admin.customers.index') }}" class="d-flex" style="gap:10px;">
|
||||
|
||||
<input type="text"
|
||||
name="search"
|
||||
value="{{ $search ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="Search customer name, email, mobile, customer ID...">
|
||||
|
||||
{{-- Preserve status on search --}}
|
||||
@if(!empty($status))
|
||||
<input type="hidden" name="status" value="{{ $status }}">
|
||||
@endif
|
||||
|
||||
<button class="btn btn-primary">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{{-- STATUS FILTER --}}
|
||||
<div>
|
||||
<a href="{{ route('admin.customers.index', ['status'=>'active', 'search'=>$search ?? '']) }}"
|
||||
class="btn btn-success {{ ($status ?? '') == 'active' ? 'active' : '' }}">
|
||||
Active
|
||||
</a>
|
||||
|
||||
<a href="{{ route('admin.customers.index', ['status'=>'inactive', 'search'=>$search ?? '']) }}"
|
||||
class="btn btn-danger {{ ($status ?? '') == 'inactive' ? 'active' : '' }}">
|
||||
Inactive
|
||||
</a>
|
||||
|
||||
<a href="{{ route('admin.customers.index') }}"
|
||||
class="btn btn-secondary {{ empty($status) ? 'active' : '' }}">
|
||||
All
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h4>Customer List</h4>
|
||||
<a href="{{ route('admin.customers.add') }}" class="btn btn-success">
|
||||
<i class="bi bi-plus-circle"></i> Add Customer
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
{{-- TABLE --}}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Customer Info</th>
|
||||
<th>Customer ID</th>
|
||||
<th>Create Date</th>
|
||||
<th>Status</th>
|
||||
<th width="120">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@forelse($customers as $c)
|
||||
<tr>
|
||||
|
||||
{{-- CUSTOMER INFO --}}
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
{{-- Avatar --}}
|
||||
<div class="rounded-circle bg-primary text-white d-flex align-items-center justify-content-center me-3"
|
||||
style="width:45px; height:45px; font-size:18px;">
|
||||
{{ strtoupper(substr($c->customer_name,0,1)) }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>{{ $c->customer_name }}</strong><br>
|
||||
|
||||
{{-- Customer Type --}}
|
||||
@if($c->customer_type == 'premium')
|
||||
<span class="badge bg-purple">Premium Customer</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">Regular Customer</span>
|
||||
@endif
|
||||
|
||||
<div class="text-muted">{{ $c->email }}</div>
|
||||
<div class="text-muted">{{ $c->mobile_no }}</div>
|
||||
|
||||
<div class="text-muted">{{ $c->orders->count() }} orders</div>
|
||||
<div class="text-muted">
|
||||
₹{{ number_format($c->orders->sum('ttl_amount'), 2) }} total
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
|
||||
{{-- CUSTOMER ID --}}
|
||||
<td>{{ $c->customer_id }}</td>
|
||||
|
||||
{{-- CREATED DATE --}}
|
||||
<td>{{ $c->created_at ? $c->created_at->format('d-m-Y') : '-' }}</td>
|
||||
|
||||
{{-- STATUS --}}
|
||||
<td>
|
||||
@if($c->status === 'active')
|
||||
<span class="badge bg-success">Active</span>
|
||||
@else
|
||||
<span class="badge bg-danger">Inactive</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
{{-- ACTION BUTTONS --}}
|
||||
<td>
|
||||
|
||||
{{-- VIEW --}}
|
||||
<a href="{{ route('admin.customers.view', $c->id) }}"
|
||||
class="btn btn-sm btn-primary">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
|
||||
{{-- TOGGLE STATUS --}}
|
||||
<form action="{{ route('admin.customers.status', $c->id) }}"
|
||||
method="POST" style="display:inline-block;">
|
||||
@csrf
|
||||
<button class="btn btn-sm btn-warning" title="Toggle Status">
|
||||
<i class="bi bi-power"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="text-center text-muted">
|
||||
No customers found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
95
resources/views/admin/customers_add.blade.php
Normal file
95
resources/views/admin/customers_add.blade.php
Normal file
@@ -0,0 +1,95 @@
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('page-title', 'Add Customer')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="container py-4">
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-light">
|
||||
<strong>Add New Customer</strong>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form action="{{ route('admin.customers.store') }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="row g-3">
|
||||
|
||||
{{-- CUSTOMER NAME --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Customer Name *</label>
|
||||
<input type="text" name="customer_name" class="form-control" required>
|
||||
</div>
|
||||
|
||||
{{-- COMPANY NAME --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Company Name</label>
|
||||
<input type="text" name="company_name" class="form-control">
|
||||
</div>
|
||||
|
||||
{{-- DESIGNATION --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Designation</label>
|
||||
<input type="text" name="designation" class="form-control">
|
||||
</div>
|
||||
|
||||
{{-- EMAIL --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Email *</label>
|
||||
<input type="email" name="email" class="form-control" required>
|
||||
</div>
|
||||
|
||||
{{-- MOBILE --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Mobile No *</label>
|
||||
<input type="text" name="mobile_no" class="form-control" required>
|
||||
</div>
|
||||
|
||||
{{-- PINCODE --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Pincode</label>
|
||||
<input type="text" name="pincode" class="form-control">
|
||||
</div>
|
||||
|
||||
{{-- ADDRESS --}}
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Address</label>
|
||||
<textarea name="address" class="form-control" rows="2"></textarea>
|
||||
</div>
|
||||
|
||||
{{-- CUSTOMER TYPE --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Customer Type *</label>
|
||||
<select name="customer_type" class="form-select" required>
|
||||
<option value="regular">Regular</option>
|
||||
<option value="premium">Premium</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- STATUS --}}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Status *</label>
|
||||
<select name="status" class="form-select" required>
|
||||
<option value="active">Active</option>
|
||||
<option value="inactive">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-end mt-4">
|
||||
<a href="{{ route('admin.customers.index') }}" class="btn btn-secondary">Cancel</a>
|
||||
<button class="btn btn-success">Create Customer</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
179
resources/views/admin/customers_view.blade.php
Normal file
179
resources/views/admin/customers_view.blade.php
Normal file
@@ -0,0 +1,179 @@
|
||||
@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
|
||||
@@ -181,7 +181,12 @@
|
||||
<i class="bi bi-receipt"></i> Invoice
|
||||
</a>
|
||||
|
||||
<a href="{{ route('admin.customers') }}" class="{{ request()->routeIs('admin.customers') ? 'active' : '' }}"><i class="bi bi-people"></i> Customers</a>
|
||||
<a href="{{ route('admin.customers.index') }}"
|
||||
class="{{ request()->routeIs('admin.customers.index') ? '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.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') }}"
|
||||
|
||||
Reference in New Issue
Block a user