From daf7d9b9dce841d6da605f154f55397bbcb50fe8 Mon Sep 17 00:00:00 2001 From: Kwesi Banson Jnr Date: Mon, 27 Jul 2026 13:43:09 +0000 Subject: [PATCH] updated client module --- app/Http/Controllers/ClientsController.php | 8 +++++-- resources/views/clients/index.blade.php | 28 ++++++++++++++++------ resources/views/clients/show.blade.php | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/ClientsController.php b/app/Http/Controllers/ClientsController.php index 1cfeaf6..8f228b9 100644 --- a/app/Http/Controllers/ClientsController.php +++ b/app/Http/Controllers/ClientsController.php @@ -207,14 +207,18 @@ class ClientsController extends Controller } if ($request->filled('service')) { - $query->whereJsonContains('services', $request->service); + $query->whereJsonContains('services', strtoupper($request->service)); } if ($request->filled('billing')) { $query->where('pay_mode', $request->billing); } + if ($request->filled('status')) { + $query->where('status', $request->status); + } - return $query->orderBy('created_at', 'desc'); + // return $query->orderBy('created_at', 'desc'); + return $query->orderBy('name', 'asc'); } /** diff --git a/resources/views/clients/index.blade.php b/resources/views/clients/index.blade.php index 105ff88..ce736a6 100644 --- a/resources/views/clients/index.blade.php +++ b/resources/views/clients/index.blade.php @@ -82,22 +82,32 @@ -
+
-
+
+
+ +
@@ -161,7 +171,9 @@ $('#filterService, #filterBilling').on('change', function() { fetchClients(1); }); - + $('#filterService, #filterStatus').on('change', function() { + fetchClients(1); + }); // Handle Pagination Clicks dynamically $(document).on('click', '.page-link-ajax', function(e) { e.preventDefault(); @@ -302,11 +314,12 @@ const search = $('#searchClient').val(); const service = $('#filterService').val(); const billing = $('#filterBilling').val(); + const status = $('#filterStatus').val(); // Show loading state $('#clientTableBody').html(` - +
Loading clients...
@@ -316,7 +329,7 @@ $.ajax({ url: base_url + "/clients/data", type: "GET", - data: { page: page, search: search, service: service, billing: billing }, + data: { page: page, search: search, service: service, billing: billing, status:status }, success: function(response) { renderTable(response.data); renderPagination(response); @@ -334,6 +347,7 @@ const search = $('#searchClient').val(); const service = $('#filterService').val(); const billing = $('#filterBilling').val(); + const status = $('#filterStatus').val(); const format = $(this).data('format'); // 'csv' or 'pdf' // Build the query string @@ -341,10 +355,10 @@ search: search, service: service, billing: billing, + status : billing, format: format }); - window.location.href = "{{ route('clients.export') }}?" + queryParams; }); // Render Table Rows diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index bf4a28d..fbd1265 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -102,7 +102,7 @@
-
Skype
+
MS Teams
{{ $showclient->skype_name ?? 'N/A' }}