updated client module
This commit is contained in:
@@ -207,14 +207,18 @@ class ClientsController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($request->filled('service')) {
|
if ($request->filled('service')) {
|
||||||
$query->whereJsonContains('services', $request->service);
|
$query->whereJsonContains('services', strtoupper($request->service));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->filled('billing')) {
|
if ($request->filled('billing')) {
|
||||||
$query->where('pay_mode', $request->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...">
|
<input type="text" class="form-control bg-white border-start-0 ps-0" id="searchClient" placeholder="Search clients, email, or contact...">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-2">
|
||||||
<select class="form-select bg-white" id="filterService">
|
<select class="form-select bg-white" id="filterService">
|
||||||
<option value="">All Service Types</option>
|
<option value="">All Service Types</option>
|
||||||
<option value="sms">SMS</option>
|
<option value="a2p">A2P</option>
|
||||||
<option value="ussd">USSD</option>
|
<option value="ussd">USSD</option>
|
||||||
<option value="airtime">Airtime</option>
|
<option value="airtime">Airtime</option>
|
||||||
<option value="voice">Voice</option>
|
<option value="voice">Voice</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-2">
|
||||||
<select class="form-select bg-white" id="filterBilling">
|
<select class="form-select bg-white" id="filterBilling">
|
||||||
<option value="">Payment Mode: All</option>
|
<option value="">Payment Mode: All</option>
|
||||||
<option value="postpaid">Postpaid (Invoice)</option>
|
<option value="postpaid">Postpaid (Invoice)</option>
|
||||||
<option value="prepaid">Prepaid (Balance)</option>
|
<option value="prepaid">Prepaid (Balance)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -161,7 +171,9 @@
|
|||||||
$('#filterService, #filterBilling').on('change', function() {
|
$('#filterService, #filterBilling').on('change', function() {
|
||||||
fetchClients(1);
|
fetchClients(1);
|
||||||
});
|
});
|
||||||
|
$('#filterService, #filterStatus').on('change', function() {
|
||||||
|
fetchClients(1);
|
||||||
|
});
|
||||||
// Handle Pagination Clicks dynamically
|
// Handle Pagination Clicks dynamically
|
||||||
$(document).on('click', '.page-link-ajax', function(e) {
|
$(document).on('click', '.page-link-ajax', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -302,11 +314,12 @@
|
|||||||
const search = $('#searchClient').val();
|
const search = $('#searchClient').val();
|
||||||
const service = $('#filterService').val();
|
const service = $('#filterService').val();
|
||||||
const billing = $('#filterBilling').val();
|
const billing = $('#filterBilling').val();
|
||||||
|
const status = $('#filterStatus').val();
|
||||||
|
|
||||||
// Show loading state
|
// Show loading state
|
||||||
$('#clientTableBody').html(`
|
$('#clientTableBody').html(`
|
||||||
<tr>
|
<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="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>
|
<div class="mt-2 text-secondary" style="font-size: 0.85rem;">Loading clients...</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -316,7 +329,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: base_url + "/clients/data",
|
url: base_url + "/clients/data",
|
||||||
type: "GET",
|
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) {
|
success: function(response) {
|
||||||
renderTable(response.data);
|
renderTable(response.data);
|
||||||
renderPagination(response);
|
renderPagination(response);
|
||||||
@@ -334,6 +347,7 @@
|
|||||||
const search = $('#searchClient').val();
|
const search = $('#searchClient').val();
|
||||||
const service = $('#filterService').val();
|
const service = $('#filterService').val();
|
||||||
const billing = $('#filterBilling').val();
|
const billing = $('#filterBilling').val();
|
||||||
|
const status = $('#filterStatus').val();
|
||||||
const format = $(this).data('format'); // 'csv' or 'pdf'
|
const format = $(this).data('format'); // 'csv' or 'pdf'
|
||||||
|
|
||||||
// Build the query string
|
// Build the query string
|
||||||
@@ -341,10 +355,10 @@
|
|||||||
search: search,
|
search: search,
|
||||||
service: service,
|
service: service,
|
||||||
billing: billing,
|
billing: billing,
|
||||||
|
status : billing,
|
||||||
format: format
|
format: format
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
window.location.href = "{{ route('clients.export') }}?" + queryParams;
|
window.location.href = "{{ route('clients.export') }}?" + queryParams;
|
||||||
});
|
});
|
||||||
// Render Table Rows
|
// Render Table Rows
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<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 class="fw-medium text-dark">{{ $showclient->skype_name ?? 'N/A' }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|||||||
Reference in New Issue
Block a user