updated client module
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,22 +82,32 @@
|
||||
<input type="text" class="form-control bg-white border-start-0 ps-0" id="searchClient" placeholder="Search clients, email, or contact...">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-2">
|
||||
<select class="form-select bg-white" id="filterService">
|
||||
<option value="">All Service Types</option>
|
||||
<option value="sms">SMS</option>
|
||||
<option value="a2p">A2P</option>
|
||||
<option value="ussd">USSD</option>
|
||||
<option value="airtime">Airtime</option>
|
||||
<option value="voice">Voice</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-2">
|
||||
<select class="form-select bg-white" id="filterBilling">
|
||||
<option value="">Payment Mode: All</option>
|
||||
<option value="postpaid">Postpaid (Invoice)</option>
|
||||
<option value="prepaid">Prepaid (Balance)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-select bg-white" id="filterStatus">
|
||||
<option value="">Status: All</option>
|
||||
<option value="Live">Live</option>
|
||||
<option value="Prospective">Prospective</option>
|
||||
<option value="Cancelled">Cancelled</option>
|
||||
<option value="Inactive">Inactive</option>
|
||||
<option value="Prospective">Prospective</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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(`
|
||||
<tr>
|
||||
<td colspan="6" class="text-center py-5">
|
||||
<td colspan="7" class="text-center py-5">
|
||||
<div class="spinner-border text-primary" role="status" style="color: #5c4df0 !important;"></div>
|
||||
<div class="mt-2 text-secondary" style="font-size: 0.85rem;">Loading clients...</div>
|
||||
</td>
|
||||
@@ -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
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="text-muted small mb-1">Skype</div>
|
||||
<div class="text-muted small mb-1">MS Teams</div>
|
||||
<div class="fw-medium text-dark">{{ $showclient->skype_name ?? 'N/A' }}</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
Reference in New Issue
Block a user