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