main
Ilham Wara Nugroho 2026-03-04 08:53:45 +07:00
parent 2945444ea6
commit d4c500af60
4 changed files with 35 additions and 3 deletions

View File

@ -398,4 +398,12 @@ class DatasetController extends Controller
return view($this->template.'.download',$data); return view($this->template.'.download',$data);
} }
function download2025($id){
$keyId = decode_id($id);
$data['dataset'] = Dataset::with(['tabelData'])->find($keyId);
return view($this->template.'.download2025',$data);
}
} }

View File

@ -20,9 +20,15 @@
<h2 class="mt-3 text-md text-blue-500 tracking-tight leading-tight">{{ $dataset->instansi->name }}</h2> <h2 class="mt-3 text-md text-blue-500 tracking-tight leading-tight">{{ $dataset->instansi->name }}</h2>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
@if($dataset->tahun >= 2026)
<a href="{{url('opendata/dataset/download/'.encode_id(@$dataset->DatasetId))}}" class="flex-1 md:flex-none bg-blue-600 text-white px-6 py-3 rounded-xl font-bold hover:bg-blue-700 transition-all flex items-center justify-center shadow-lg shadow-blue-100"> <a href="{{url('opendata/dataset/download/'.encode_id(@$dataset->DatasetId))}}" class="flex-1 md:flex-none bg-blue-600 text-white px-6 py-3 rounded-xl font-bold hover:bg-blue-700 transition-all flex items-center justify-center shadow-lg shadow-blue-100">
<i data-lucide="download" class="w-5 h-5 mr-2"></i> Unduh Data <i data-lucide="download" class="w-5 h-5 mr-2"></i> Unduh Data
</a> </a>
@else
<a href="{{url('opendata/dataset/download2025/'.encode_id(@$dataset->DatasetId))}}" class="flex-1 md:flex-none bg-blue-600 text-white px-6 py-3 rounded-xl font-bold hover:bg-blue-700 transition-all flex items-center justify-center shadow-lg shadow-blue-100">
<i data-lucide="download" class="w-5 h-5 mr-2"></i> Unduh Data
</a>
@endif
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,17 @@
<?php
// header("Content-type: application/vnd.ms-excel");
// header("Content-Disposition: attachment; filename=Data {$dataset->name}.xls");
// header("Pragma: no-cache");
?>
<table border="1" width="100%">
<tr style="vertical-align:middle;">
@if (!empty($data))
@foreach ($data[0] as $k => $key)
<td style="background:#ddd;">{{ ucwords(str_replace('_', ' ', $k)) }}</td>
@endforeach
@endif
</tr>
</table>

View File

@ -47,6 +47,7 @@ Route::post('login',[CustomLoginController::class,'post_login'])->name('post_log
Route::get('register',[CustomRegisterController::class,'index'])->name('register'); Route::get('register',[CustomRegisterController::class,'index'])->name('register');
Route::post('register',[CustomRegisterController::class,'post_register'])->name('post_register'); Route::post('register',[CustomRegisterController::class,'post_register'])->name('post_register');
Route::get('opendata/dataset/download/{id?}',[DatasetController::class,'download'])->name('download'); Route::get('opendata/dataset/download/{id?}',[DatasetController::class,'download'])->name('download');
Route::get('opendata/dataset/download2025/{id?}',[DatasetController::class,'download2025'])->name('download2025');
Route::get('getInstansi/{type}',[AjaxController::class,'getInstansi'])->name('getInstansi'); Route::get('getInstansi/{type}',[AjaxController::class,'getInstansi'])->name('getInstansi');