Account Section UI Changes
This commit is contained in:
@@ -9,36 +9,42 @@ use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdminCustomerController extends Controller
|
||||
{
|
||||
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// LIST CUSTOMERS (with search + status filter)
|
||||
// ---------------------------------------------------------
|
||||
public function index(Request $request)
|
||||
{
|
||||
$search = $request->search;
|
||||
$status = $request->status;
|
||||
{
|
||||
$search = $request->search;
|
||||
$status = $request->status;
|
||||
|
||||
$query = User::with(['marks', 'orders'])->orderBy('id', 'desc');
|
||||
$query = User::with(['marks', 'orders'])->orderBy('id', 'desc');
|
||||
|
||||
// SEARCH FILTER
|
||||
if (!empty($search)) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('customer_name', 'like', "%$search%")
|
||||
->orWhere('email', 'like', "%$search%")
|
||||
->orWhere('mobile_no', 'like', "%$search%")
|
||||
->orWhere('customer_id', 'like', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// STATUS FILTER
|
||||
if (!empty($status) && in_array($status, ['active', 'inactive'])) {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
|
||||
$customers = $query->get();
|
||||
|
||||
return view('admin.customers', compact('customers', 'search', 'status'));
|
||||
// SEARCH FILTER
|
||||
if (!empty($search)) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('customer_name', 'like', "%$search%")
|
||||
->orWhere('email', 'like', "%$search%")
|
||||
->orWhere('mobile_no', 'like', "%$search%")
|
||||
->orWhere('customer_id', 'like', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// STATUS FILTER
|
||||
if (!empty($status) && in_array($status, ['active', 'inactive'])) {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
|
||||
// Get all customers for statistics (without pagination)
|
||||
$allCustomers = $query->get();
|
||||
|
||||
// Get paginated customers for the table (10 per page)
|
||||
$customers = $query->paginate(10);
|
||||
|
||||
return view('admin.customers', compact('customers', 'allCustomers', 'search', 'status'));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// SHOW ADD CUSTOMER FORM
|
||||
// ---------------------------------------------------------
|
||||
@@ -130,5 +136,6 @@ class AdminCustomerController extends Controller
|
||||
|
||||
return back()->with('success', 'Customer status updated.');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ class RequestController extends Controller
|
||||
'pincode' => $request->pincode,
|
||||
'date' => Carbon::now()->toDateString(), // Auto current date
|
||||
'status' => 'pending', // Default status
|
||||
|
||||
|
||||
]);
|
||||
|
||||
// ✅ Response
|
||||
|
||||
Reference in New Issue
Block a user