search and pagination 2
This commit is contained in:
parent
4767cae919
commit
060b916e40
|
|
@ -11,11 +11,18 @@ class AduanController extends Controller
|
|||
/**
|
||||
* Tampilkan semua aduan
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$search = $request->search;
|
||||
|
||||
$aduan = AduanTps::with('lokasiTps')
|
||||
->when($search, function ($query) use ($search) {
|
||||
$query->whereHas('lokasiTps', function ($q) use ($search) {
|
||||
$q->where('nama_tps', 'like', '%' . $search . '%');
|
||||
});
|
||||
})
|
||||
->orderBy('tanggal_aduan', 'desc')
|
||||
->get();
|
||||
->paginate(10);
|
||||
|
||||
return view('admin.aduan.index', compact('aduan'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,16 @@
|
|||
class InformasiController extends Controller
|
||||
{
|
||||
// Menampilkan semua informasi
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$informasi = Informasi::orderBy('tanggal_informasi', 'desc')->get();
|
||||
$search = $request->search;
|
||||
|
||||
$informasi = Informasi::when($search, function ($query) use ($search) {
|
||||
$query->where('judul', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orderBy('tanggal_informasi', 'desc')
|
||||
->paginate(10);
|
||||
|
||||
return view('admin.informasi.index', compact('informasi'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,17 @@
|
|||
|
||||
class KategoriTpsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$title = 'Kategori TPS';
|
||||
$kategori = KategoriTps::all();
|
||||
$search = $request->search;
|
||||
|
||||
$kategori = KategoriTps::when($search, function ($query) use ($search) {
|
||||
$query->where('nama_kategori', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orderBy('id_kategori_tps', 'desc')
|
||||
->paginate(10);
|
||||
|
||||
return view('admin.kategori-tps.index', compact('title', 'kategori'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,19 +8,36 @@
|
|||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SampahController extends Controller
|
||||
{
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
Carbon::setLocale('id');
|
||||
|
||||
$title = 'Data Sampah';
|
||||
|
||||
$sampah = Sampah::with('user')
|
||||
->orderBy('tahun', 'desc')
|
||||
$tahun = $request->tahun;
|
||||
|
||||
$query = Sampah::with('user');
|
||||
|
||||
// Filter tahun jika dipilih
|
||||
if ($tahun) {
|
||||
$query->where('tahun', $tahun);
|
||||
}
|
||||
|
||||
$sampah = $query->orderBy('tahun', 'desc')
|
||||
->orderBy('bulan', 'desc')
|
||||
->get();
|
||||
|
||||
return view('admin.sampah.index', compact('title', 'sampah'));
|
||||
// ambil daftar tahun untuk dropdown filter
|
||||
$listTahun = Sampah::select('tahun')
|
||||
->distinct()
|
||||
->orderBy('tahun', 'desc')
|
||||
->pluck('tahun');
|
||||
|
||||
return view('admin.sampah.index', compact('title', 'sampah', 'listTahun'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
|
|
|
|||
|
|
@ -27779,9 +27779,11 @@ .navbar .navbar-brand-wrapper .brand-logo-mini {
|
|||
}
|
||||
|
||||
.navbar .navbar-brand-wrapper .brand-logo-mini img {
|
||||
width: calc(70px - 30px);
|
||||
width: 30px;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
margin: auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.navbar .navbar-menu-wrapper {
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 951 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 MiB |
|
|
@ -17,6 +17,16 @@
|
|||
Daftar aduan masyarakat terhadap TPS
|
||||
</p>
|
||||
</div>
|
||||
<div class="mb-3 d-flex align-items-center">
|
||||
|
||||
<!-- SEARCH -->
|
||||
<form action="{{ route('admin.aduan.index') }}" method="GET"
|
||||
style="width:300px; margin-right:20px;">
|
||||
<input type="text" name="search" value="{{ request('search') }}"
|
||||
class="form-control" placeholder="Cari Aduan...">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabel -->
|
||||
|
|
@ -56,18 +66,15 @@
|
|||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ route('admin.aduan.show', $item->id_aduan) }}"
|
||||
class="btn btn-warning btn-sm"
|
||||
title="Tanggapi Aduan">
|
||||
class="btn btn-warning btn-sm" title="Tanggapi Aduan">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
|
||||
<form action="{{ route('admin.aduan.destroy', $item->id_aduan) }}"
|
||||
method="POST"
|
||||
class="d-inline form-hapus">
|
||||
method="POST" class="d-inline form-hapus">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit"
|
||||
class="btn btn-danger btn-sm"
|
||||
<button type="submit" class="btn btn-danger btn-sm"
|
||||
title="Hapus Aduan">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
|
|
@ -84,6 +91,10 @@ class="btn btn-danger btn-sm"
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- PAGINATION -->
|
||||
<div class="mt-3">
|
||||
{{ $aduan->appends(request()->query())->links() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,10 +29,21 @@
|
|||
Daftar semua berita dan pengumuman
|
||||
</p>
|
||||
</div>
|
||||
<div class="mb-3 d-flex align-items-center">
|
||||
|
||||
<!-- SEARCH -->
|
||||
<form action="{{ route('admin.informasi.index') }}" method="GET"
|
||||
style="width:300px; margin-right:20px;">
|
||||
<input type="text" name="search" value="{{ request('search') }}"
|
||||
class="form-control" placeholder="Cari judul informasi...">
|
||||
</form>
|
||||
|
||||
<!-- BUTTON TAMBAH -->
|
||||
<a href="{{ route('admin.informasi.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg"></i> Tambah
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
|
|
@ -102,6 +113,10 @@ class="btn btn-warning btn-sm me-1" title="Edit">
|
|||
|
||||
</table>
|
||||
</div>
|
||||
<!-- PAGINATION -->
|
||||
<div class="mt-3">
|
||||
{{ $informasi->appends(request()->query())->links() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,13 +5,17 @@
|
|||
@section('content')
|
||||
<style>
|
||||
.deskripsi-truncate-div {
|
||||
max-width: 300px; /* lebar kolom deskripsi */
|
||||
white-space: normal !important; /* override Bootstrap */
|
||||
max-width: 300px;
|
||||
/* lebar kolom deskripsi */
|
||||
white-space: normal !important;
|
||||
/* override Bootstrap */
|
||||
word-wrap: break-word !important;
|
||||
overflow-wrap: break-word !important;
|
||||
}
|
||||
|
||||
.table td {
|
||||
vertical-align: top; /* supaya teks membungkus ke bawah */
|
||||
vertical-align: top;
|
||||
/* supaya teks membungkus ke bawah */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -27,9 +31,21 @@
|
|||
Daftar Kategori Tempat Pembuangan Sampah (TPS)
|
||||
</p>
|
||||
</div>
|
||||
<a href="{{ route('admin.kategori.create') }}" class="btn btn-primary">
|
||||
<div class="mb-3 d-flex align-items-center">
|
||||
|
||||
<!-- SEARCH -->
|
||||
<form action="{{ route('admin.informasi.index') }}" method="GET"
|
||||
style="width:300px; margin-right:20px;">
|
||||
<input type="text" name="search" value="{{ request('search') }}"
|
||||
class="form-control" placeholder="Cari kategori TPS...">
|
||||
</form>
|
||||
|
||||
<!-- BUTTON TAMBAH -->
|
||||
<a href="{{ route('admin.informasi.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg"></i> Tambah
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
|
|
@ -101,7 +117,8 @@ class="btn btn-warning btn-sm me-1" title="Edit">
|
|||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal',
|
||||
didOpen: () => {
|
||||
document.querySelector('.swal2-popup').style.fontFamily = 'Nunito, sans-serif';
|
||||
document.querySelector('.swal2-popup').style.fontFamily =
|
||||
'Nunito, sans-serif';
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
|
|
|||
|
|
@ -10,21 +10,41 @@
|
|||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="mb-3 d-flex justify-content-between align-items-center">
|
||||
<div class="mb-4 d-flex justify-content-between align-items-center">
|
||||
|
||||
<div>
|
||||
<h4 class="mb-0 card-title">Data Sampah Bulanan</h4>
|
||||
<p class="mb-0 card-description">
|
||||
<h4 class="mb-1 card-title">Data Sampah Bulanan</h4>
|
||||
<p class="mb-0 text-muted">
|
||||
Daftar data sampah per bulan
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 d-flex justify-content-between align-items-center">
|
||||
|
||||
<form method="GET" action="{{ route('admin.sampah.index') }}" class="w-50">
|
||||
|
||||
<select name="tahun" class="form-control" onchange="this.form.submit()">
|
||||
<option value="">Filter Tahun...</option>
|
||||
|
||||
@foreach ($listTahun as $thn)
|
||||
<option value="{{ $thn }}"
|
||||
{{ request('tahun') == $thn ? 'selected' : '' }}>
|
||||
{{ $thn }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
</form>
|
||||
|
||||
<a href="{{ route('admin.sampah.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg"></i> Tambah
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table">
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<!-- inject:css -->
|
||||
<link rel="stylesheet" href="{{ asset('assets/admin/css/vertical-layout-light/style.css') }}">
|
||||
<!-- endinject -->
|
||||
<link rel="shortcut icon" href="{{ asset('assets/admin/images/icn.png') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('assets/admin/images/iconsig.png') }}" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
|
||||
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
style="height: 55px; width: auto;" class="mr-2">
|
||||
</a>
|
||||
<a class="navbar-brand brand-logo-mini" href="index.html"><img
|
||||
src="{{ asset('assets/admin/images/icon-mini.png') }}" alt="logo" /></a>
|
||||
src="{{ asset('assets/admin/images/iconsig.png') }}" alt="logo" /></a>
|
||||
</div>
|
||||
<div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
|
||||
<button class="navbar-toggler align-self-center" type="button" data-toggle="minimize">
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
</li>
|
||||
<li class="nav-item {{ request()->routeIs('admin.kategori.index') ? 'active' : '' }}">
|
||||
<a class="nav-link" href="{{ route('admin.kategori.index') }}">
|
||||
<i class="icon-paper menu-icon"></i>
|
||||
<i class="icon-menu menu-icon"></i>
|
||||
<span class="menu-title">Kategori TPS</span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
</li>
|
||||
<li class="nav-item {{ request()->routeIs('admin.informasi.index') ? 'active' : '' }}">
|
||||
<a class="nav-link" href="{{ route('admin.informasi.index') }}">
|
||||
<i class="icon-mail menu-icon"></i>
|
||||
<i class="icon-paper menu-icon"></i>
|
||||
<span class="menu-title">Kelola Informasi</span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -28,22 +28,22 @@
|
|||
<div class="mb-4 text-center row">
|
||||
|
||||
<div class="col-md-3">
|
||||
<h4>{{ number_format($rekap['timbulan'], 0, ',', '.') }}</h4>
|
||||
<h4>{{ number_format($rekap['timbulan'], 0, ',', '.') }} Ton</h4>
|
||||
<p>Total Timbulan</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<h4>{{ number_format($rekap['kelola'], 0, ',', '.') }}</h4>
|
||||
<h4>{{ number_format($rekap['kelola'], 0, ',', '.') }} Ton</h4>
|
||||
<p>Total Dikelola</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<h4>{{ number_format($rekap['daur'], 0, ',', '.') }}</h4>
|
||||
<h4>{{ number_format($rekap['daur'], 0, ',', '.') }} Ton</h4>
|
||||
<p>Total Daur Ulang</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<h4>{{ number_format($rekap['sisa'], 0, ',', '.') }}</h4>
|
||||
<h4>{{ number_format($rekap['sisa'], 0, ',', '.') }} Ton</h4>
|
||||
<p>Total Sisa</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -95,18 +95,35 @@
|
|||
plugins: {
|
||||
legend: {
|
||||
position: 'top'
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: function(context) {
|
||||
return context.dataset.label + ': ' + context.raw.toLocaleString('id-ID') +
|
||||
' Ton';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true
|
||||
beginAtZero: true,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Jumlah Sampah (Ton)'
|
||||
},
|
||||
},
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Bulan'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<!-- About Section -->
|
||||
<section id="about" class="about section">
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
<meta name="keywords" content="">
|
||||
|
||||
<!-- Favicons -->
|
||||
<link href="{{ asset('assets/user/img/favicon.png') }}" rel="icon">
|
||||
<link href="{{ asset('assets/user/img/apple-touch-icon.png') }}" rel="apple-touch-icon">
|
||||
<link href="{{ asset('assets/user/img/iconsig.png') }}" rel="icon">
|
||||
<link href="{{ asset('assets/user/img/iconsig.png') }}" rel="apple-touch-icon">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com" rel="preconnect">
|
||||
|
|
|
|||
Loading…
Reference in New Issue