main
Ilham Wara Nugroho 2026-03-04 08:41:49 +07:00
parent 4dfd6f1afb
commit f04688a06d
5 changed files with 41 additions and 43 deletions

View File

@ -46,21 +46,24 @@ class FrontController extends Controller
return view('dataset-detail',$data);
}
public function gridDetail2025(Request $request){
$id = $request->query('id');
$keyId = $id;
$item = Dataset::find($keyId); // atau pakai ->pluck(), ->find(), dll
$json = json_decode($item->data, true);
$limit = $request->input('limit', 10);
$offset = $request->input('offset', 0);
$rows = array_slice($json, $offset, $limit);
return response()->json([
'total' => count($json),
'rows' => $rows
]);
}
public function gridDetail(Request $request)
{
// $id = $request->query('id');
// $keyId = $id;
// $item = Dataset::find($keyId); // atau pakai ->pluck(), ->find(), dll
// $json = json_decode($item->data, true);
// $limit = $request->input('limit', 10);
// $offset = $request->input('offset', 0);
// $rows = array_slice($json, $offset, $limit);
// return response()->json([
// 'total' => count($json),
// 'rows' => $rows
// ]);
$id = $request->query('id');
$keyId = decode_id($id);

View File

@ -54,7 +54,8 @@
{{-- <span class="text-xs font-bold text-slate-400 uppercase">Jumlah Row Data: 100</span> --}}
</div>
<div class="overflow-x-auto custom-scrollbar">
<table class="w-full text-left text-sm" id="table"
@if ($dataset->tahun >= 2026)
<table class="w-full text-left text-sm" id="table"
data-toggle="table"
data-search="false"
data-pagination="false"
@ -69,6 +70,27 @@
</tr>
</thead>
</table>
@else
<?php $data = json_decode($dataset->data); ?>
<table id="table"
data-toggle="table"
data-search="false"
data-pagination="true"
data-side-pagination="server"
data-url="{{ url('dataset/Griddetail?id='.@$keyId) }}"
>
<thead>
<tr class="bg-primary-light text-primary">
@if (!empty($data))
@foreach ($data[0] as $k => $key)
<th data-field="{{$k}}" class="gridjs-td gridjs-th text-xs">{{ ucwords(str_replace('_', ' ', $k)) }}</th>
@endforeach
@endif
</tr>
</thead>
</table>
@endif
</div>
</section>
</div>

View File

@ -45,22 +45,6 @@
<div class="bg-white rounded-[20px] shadow-lg p-5 py-10 gap-6 flex">
<div style="overflow-x:auto; width:100%!important;">
<table id="table"
data-toggle="table"
data-search="false"
data-pagination="true"
data-side-pagination="server"
data-url="{{ url('dataset/Griddetail?id='.encode_id($keyId)) }}">
<thead>
<tr class="bg-primary-light text-primary">
<th data-field="no" class="gridjs-td gridjs-th text-xs">No</th>
@foreach ($tabel as $k => $key)
<th data-field="{{$key->order}}" class="gridjs-td gridjs-th text-xs">{{ $key->name }}</th>
@endforeach
</tr>
</thead>
</table>
{{-- <table id="table"
data-toggle="table"
data-search="false"

View File

@ -195,19 +195,7 @@
}
});
$('#togglePassword').on('click', function() {
let passwordField = $('#password');
let icon = $(this).find('i');
// Cek apakah input saat ini bertipe password
if (passwordField.attr('type') === 'password') {
passwordField.attr('type', 'text'); // Ubah ke teks
icon.removeClass('ri-eye-line').addClass('ri-eye-2-line'); // Ganti ikon
} else {
passwordField.attr('type', 'password'); // Ubah ke password
icon.removeClass('ri-eye-2-line').addClass('ri-eye-line'); // Kembalikan ikon
}
});
</script>
@yield('js')
</body>

View File

@ -38,6 +38,7 @@ Route::get('/resource-data', [FrontController::class,'resource'])->name('resourc
Route::get('/dataset', [FrontController::class,'dataset'])->name('dataset');
Route::get('/dataset/detail/{id}', [FrontController::class,'dataset_detail'])->name('dataset_detail');
Route::get('/dataset/Griddetail', [FrontController::class,'Griddetail'])->name('Griddetail');
Route::get('/dataset/Griddetail2025', [FrontController::class,'Griddetail2025'])->name('Griddetail2025');
Route::get('/dataset-tambahan', [FrontController::class,'datasetTambahan'])->name('datasetTambahan');
Route::get('/dataset-tambahan/detail/{id}', [FrontController::class,'datasetTambahan_detail'])->name('datasetTambahan');
Route::get('/search', [FrontController::class,'search'])->name('search');