feat(ui): Perbaikan tampilan dan fungsionalitas halaman index untuk manajemen pengguna

- Memperbaiki fungsi export data pengguna dengan format yang lebih rapi
- Update semua controller (Permissions, Positions, Roles, Users) untuk konsistensi response dan error handling
- Tambahan fungsi `goPage(1)` pada event listener pencarian untuk langsung ke halaman pertama saat melakukan pencarian
This commit is contained in:
Daeng Deni Mardaeni
2025-08-20 09:41:52 +07:00
parent c348af2484
commit 59721337a8
7 changed files with 143 additions and 120 deletions

View File

@@ -223,11 +223,7 @@
// Apply search filter if provided
if ($request->has('search') && !empty($request->get('search'))) {
$search = $request->get('search');
$query->where(function ($q) use ($search) {
$q->whereRaw('LOWER(code) LIKE ?', ['%' . strtolower($search) . '%'])
->orWhereRaw('LOWER(name) LIKE ?', ['%' . strtolower($search) . '%'])
->orWhereRaw('CAST(level AS TEXT) LIKE ?', ['%' . $search . '%']);
});
$query->whereAny(['code', 'name', 'level'], 'like', '%' . $search . '%');
}
// Apply sorting if provided
@@ -253,7 +249,7 @@
$filteredRecords = $query->count();
// Get the data for the current page
$positions = $query->get();
$data = $query->get();
// Calculate the page count
$size = $request->get('size', 10); // Default to 10 if not set
@@ -270,7 +266,7 @@
'pageCount' => $pageCount,
'page' => $currentPage,
'totalCount' => $totalRecords,
'data' => $positions,
'data' => $data,
]);
}