main
Ilham Wara Nugroho 2026-05-12 10:33:59 +07:00
parent 160109463a
commit 6927037892
5 changed files with 48 additions and 61 deletions

View File

@ -14,6 +14,14 @@ use App\Models\SK;
use App\Models\Master\MasterGroup; use App\Models\Master\MasterGroup;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
if (!function_exists('wilayah')) {
function wilayah($npsn){
$sekolah = Sekolah::where('npsn',$npsn)->first();
return @$sekolah->kabupaten->name;
}
}
if (!function_exists('configEnvApp')) { if (!function_exists('configEnvApp')) {
function configEnvApp(){ function configEnvApp(){
if (config('app.env') === 'local') { if (config('app.env') === 'local') {
@ -24,6 +32,7 @@ if (!function_exists('configEnvApp')) {
} }
} }
if (!function_exists('s3Assetupload')) { if (!function_exists('s3Assetupload')) {
function s3Assetupload($path,$file){ function s3Assetupload($path,$file){
Storage::disk('s3')->put(configEnvApp().$path, file_get_contents($file), 'public'); Storage::disk('s3')->put(configEnvApp().$path, file_get_contents($file), 'public');

View File

@ -144,6 +144,22 @@ class HomeController extends Controller
SUM(b3::integer) as b3, SUM(b3::integer) as b3,
SUM(minyak_jelantah::integer) as minyak SUM(minyak_jelantah::integer) as minyak
')->first(); ')->first();
$data['ranking_sekolah'] = \DB::table('penilaian as p')
->join('ms_sekolah as ms', 'ms.MsSekolahId', '=', 'p.ms_sekolah_id')
->select(
'p.ms_sekolah_id',
'ms.nama_sekolah',
'ms.npsn',
\DB::raw('COUNT(*) as total_pengelolaan_sampah')
)
->whereRaw(
"p.value::text ILIKE '%Pengelolaan Sampah%'"
)
->groupBy('p.ms_sekolah_id', 'ms.nama_sekolah','ms.npsn')
->orderByDesc('total_pengelolaan_sampah')
->limit(4)
->get();
} }
$data['route'] = 'modules'; $data['route'] = 'modules';

View File

@ -9,7 +9,7 @@ class SampahBelumTerkelolaController extends Controller
{ {
protected $template = 'modules.sampah-belum'; protected $template = 'modules.sampah-belum';
protected $route = 'modules.sampah-belum'; protected $route = 'modules.sampah-belum';
protected $title = 'Sampah Belum Terkelola'; protected $title = 'Timbulan Sampah';
/** /**
* Display a listing of the resource. * Display a listing of the resource.

View File

@ -231,70 +231,26 @@
<div class="col-sm-12 col-xl-6"> <div class="col-sm-12 col-xl-6">
<h5 class="fw-500 text-warning"><i class="fal fa-trophy"></i>&nbsp;Ranking Sekolah Pengolahan Sampah</h5> <h5 class="fw-500 text-warning"><i class="fal fa-trophy"></i>&nbsp;Ranking Sekolah Pengolahan Sampah</h5>
<div class="row"> <div class="row">
@foreach ($ranking_sekolah as $dataSekolah)
<div class="col-xl-12 col-sm-6 mb-2"> <div class="col-xl-12 col-sm-6 mb-2">
<div class="card"> <div class="card">
<div class="card-body p-3"> <div class="card-body p-3">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>
<h5><b>SD NEGERI TOMANG 08 PAGI</b></h5> <h5><b>{{ $dataSekolah->nama_sekolah }}</b></h5>
<span class="badge bg-warning-light text-warning">Jakarta Barat</span> <span class="badge bg-warning-light text-warning">{{wilayah($dataSekolah->npsn)}}</span>
<span class="badge bg-success-light text-success">Adiwiyata Provinsi</span> <span class="badge bg-success-light text-success">{{levelAdiwiyata($dataSekolah->npsn)}}</span>
</div> </div>
<div class="bg-primary-light text-primary p-3 rounded-circle"> <div class="bg-primary-light text-primary p-3 rounded-circle">
<h5 class="fw-500 f16">80%</h5> <h6 class="fw-500 mb-0">{{ $dataSekolah->total_pengelolaan_sampah }}%</h6>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12 col-sm-6 mb-2">
<div class="card">
<div class="card-body p-3">
<div class="d-flex justify-content-between align-items-center">
<div>
<h5><b>SD NEGERI TOMANG 08 PAGI</b></h5>
<span class="badge bg-warning-light text-warning">Jakarta Barat</span>
<span class="badge bg-success-light text-success">Adiwiyata Provinsi</span>
</div>
<div class="bg-primary-light text-primary p-3 rounded-circle">
<h5 class="fw-500 f16 ">80%</h5>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12 col-sm-6 mb-2">
<div class="card">
<div class="card-body p-3">
<div class="d-flex justify-content-between align-items-center">
<div>
<h5><b>SD NEGERI TOMANG 08 PAGI</b></h5>
<span class="badge bg-warning-light text-warning">Jakarta Barat</span>
<span class="badge bg-success-light text-success">Adiwiyata Provinsi</span>
</div>
<div class="bg-primary-light text-primary p-3 rounded-circle">
<h5 class="fw-500 f16 ">80%</h5>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12 col-sm-6 mb-2">
<div class="card">
<div class="card-body p-3">
<div class="d-flex justify-content-between align-items-center">
<div>
<h5><b>SD NEGERI TOMANG 08 PAGI</b></h5>
<span class="badge bg-warning-light text-warning">Jakarta Barat</span>
<span class="badge bg-success-light text-success">Adiwiyata Provinsi</span>
</div>
<div class="bg-primary-light text-primary p-3 rounded-circle">
<h5 class="fw-500 f16 ">80%</h5>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endforeach
</div> </div>
</div> </div>
</div> </div>

View File

@ -23,6 +23,12 @@ use App\Http\Controllers\StorageController;
| be assigned to the "web" middleware group. Make something great! | be assigned to the "web" middleware group. Make something great!
| |
*/ */
Route::get('testing',function(){
dd($data);
});
Route::get('/fileasset',[StorageController::class,'fileasset'])->name('fileasset'); Route::get('/fileasset',[StorageController::class,'fileasset'])->name('fileasset');
Route::get('/storage-list-file',[StorageController::class,'storagelistfile'])->name('storagelistfile'); Route::get('/storage-list-file',[StorageController::class,'storagelistfile'])->name('storagelistfile');
Route::get('s3/migration',[StorageController::class,'s3migration'])->name('s3migration'); Route::get('s3/migration',[StorageController::class,'s3migration'])->name('s3migration');