main
Ilham Wara Nugroho 2025-09-15 10:21:13 +07:00
parent eac4535876
commit 7a6f145e9d
3 changed files with 57 additions and 39 deletions

View File

@ -32,4 +32,33 @@ class FrontController extends Controller
$data['kegiatan'] = Kegiatan::orderBy('KegiatanId','DESC')->paginate(8); $data['kegiatan'] = Kegiatan::orderBy('KegiatanId','DESC')->paginate(8);
return view('galeri',$data); return view('galeri',$data);
} }
function dataSekolah(){
$data = [
['name' => 'SMPN 253','kota' => 'Jakarta Selatan','skor' => '89,86','tahun' => '2024'],
['name' => 'SDI Al Irsyad Islamiyah','kota' => 'Jakarta Pusat','skor' => '89,85','tahun' => '2024'],
['name' => 'SDN Kemanggisan 17','kota' => 'Jakarta Barat','skor' => '89,45','tahun' => ''],
['name' => 'SDN Sukabumi Utara 07','kota' => 'Jakarta Barat','skor' => '89,54','tahun' => ''],
['name' => 'SDS Strada Santo Ignatius','kota' => 'Jakarta Utara','skor' => '89,24','tahun' => ''],
['name' => 'SDN Jatinegara 06 Pagi','kota' => 'Jakarta Timur','skor' => '89,33','tahun' => ''],
['name' => 'SDN Pekayon 03 Pagi','kota' => 'Jakarta Timur','skor' => '89,43','tahun' => ''],
['name' => 'SDN Lubang Buaya 06 Pagi','kota' => 'Jakarta Timur','skor' => '89,71','tahun' => ''],
];
$_data = [];
// dd($data);
foreach ($data as $key => $row) {
$_data[] = [
'no' => $key+1,
'sekolah' => @$row['name'],
'kota' => @$row['kota'],
'skor' => @$row['skor'],
'tahun' => @$row['tahun'],
];
}
return response()->json($_data);
}
} }

View File

@ -1,54 +1,42 @@
@extends('layouts.app') @extends('layouts.app')
@section('title',@$title) @section('title',@$title)
@section('css')
<link rel="stylesheet" type="text/css" href="{{asset('assets/css/bootstrap-table.min.css')}}">
@endsection
@section('content') @section('content')
<section id="section4" class="container mx-auto p-12 md:py-12"> <section id="section4" class="container mx-auto p-12 md:py-12">
<div class="flex justify-between mb-15"> <div class="flex justify-between mb-15">
<h4 class="text-lg md:text-2xl font-extrabold text-black">Sekolah Adiwiyata</h4> <h4 class="text-lg md:text-2xl font-extrabold text-black">Sekolah Adiwiyata</h4>
</div> </div>
<div class="w-full"> <div class="w-full">
<table id="example" class="table-auto w-full"> <table class="table"
<thead> data-search="false"
<tr class="border text-center border-[#333]"> data-toggle="table"
<th class="bg-success text-white text-center border border-[#eaeaea]">No</th> data-pagination="true"
<th class="bg-success text-white text-center border border-[#eaeaea]">Sekolah</th> data-toolbar="#toolbar"
<th class="bg-success text-white text-center border border-[#eaeaea]">Kota</th> data-show-refresh="false"
<th class="bg-success text-white text-center border border-[#eaeaea]">Tahun</th> data-url="{{url('data/sekolah')}}"
<th class="bg-success text-white text-center border border-[#eaeaea]">Skor</th> data-ajax-options='{"xhrFields": {"withCredentials": true}}'
</tr> data-sort-name="ids"
</thead> data-sort-order="desc"
<tbody> data-page-size="10"
<?php data-id-field="id"
$data = [ id="grid-data">
['name' => 'SMPN 253','kota' => 'Jakarta Selatan','skor' => '89,86','tahun' => '2024'], <thead class="bg-success text-white text-center border border-[#eaeaea] px-3 py-4">
['name' => 'SDI Al Irsyad Islamiyah','kota' => 'Jakarta Pusat','skor' => '89,85','tahun' => '2024'], <tr>
['name' => 'SDN Kemanggisan 17','kota' => 'Jakarta Barat','skor' => '89,45','tahun' => ''], <th class="text-center border border-[#eaeaea] px-3 py-4" data-field="no">No</th>
['name' => 'SDN Sukabumi Utara 07','kota' => 'Jakarta Barat','skor' => '89,54','tahun' => ''], <th class="border border-[#eaeaea] px-3 py-4" data-field="sekolah">Sekolah</th>
['name' => 'SDS Strada Santo Ignatius','kota' => 'Jakarta Utara','skor' => '89,24','tahun' => ''], <th class="border border-[#eaeaea] px-3 py-4" data-field="kota">Kota</th>
['name' => 'SDN Jatinegara 06 Pagi','kota' => 'Jakarta Timur','skor' => '89,33','tahun' => ''], <th class="border border-[#eaeaea] px-3 py-4" data-field="tahun">Tahun</th>
['name' => 'SDN Pekayon 03 Pagi','kota' => 'Jakarta Timur','skor' => '89,43','tahun' => ''], <th class="border border-[#eaeaea] px-3 py-4" data-field="skor">Skor</th>
['name' => 'SDN Lubang Buaya 06 Pagi','kota' => 'Jakarta Timur','skor' => '89,71','tahun' => ''],
];
?>
@foreach($data as $k => $val)
<tr class="border">
<td class="bg-white border border-[#eaeaea] text-center">{{ $k+1 }}</td>
<td class="bg-white border border-[#eaeaea] text-center">{{ $val['name'] }}</td>
<td class="bg-white border border-[#eaeaea] text-center">{{ $val['kota'] }}</td>
<td class="bg-white border border-[#eaeaea] text-center">{{ $val['tahun'] }}</td>
<td class="bg-white border border-[#eaeaea] text-center">{{ $val['skor'] }}</td>
</tr> </tr>
@endforeach </thead>
</tbody> <tbody></tbody>
</table> </table>
</div> </div>
</section> </section>
@endsection @endsection
@section('js') @section('js')
<script src="https://code.jquery.com/jquery-3.7.1.js"></script> <script src="{{asset('assets/js/vendors.bundle.js')}}"></script>
<script src="https://cdn.datatables.net/2.3.2/js/dataTables.js"></script> <script type="text/javascript" src="{{asset('assets/js/bootstrap-table.min.js')}}"></script>
<script src="https://cdn.datatables.net/2.3.2/js/dataTables.tailwindcss.js"></script>
<script>
new DataTable('#example');
</script>
@endsection @endsection

View File

@ -44,6 +44,7 @@ Route::get('/sekolah',[FrontController::class,'sekolah'])->name('sekolah');
Route::get('/kegiatan',[FrontController::class,'kegiatan'])->name('kegiatan'); Route::get('/kegiatan',[FrontController::class,'kegiatan'])->name('kegiatan');
Route::get('/kegiatan/{slug}',[FrontController::class,'kegiatan_detail'])->name('kegiatan_detail'); Route::get('/kegiatan/{slug}',[FrontController::class,'kegiatan_detail'])->name('kegiatan_detail');
Route::get('/galeri',[FrontController::class,'galeri'])->name('galeri'); Route::get('/galeri',[FrontController::class,'galeri'])->name('galeri');
Route::get('/data/sekolah',[FrontController::class,'dataSekolah'])->name('dataSekolah');
// Auth::routes(); // Auth::routes();
// Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); // Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');