diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index 52cea22..9015fc1 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -14,6 +14,14 @@ use App\Models\SK; use App\Models\Master\MasterGroup; 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')) { function configEnvApp(){ if (config('app.env') === 'local') { @@ -24,6 +32,7 @@ if (!function_exists('configEnvApp')) { } } + if (!function_exists('s3Assetupload')) { function s3Assetupload($path,$file){ Storage::disk('s3')->put(configEnvApp().$path, file_get_contents($file), 'public'); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 781dd7d..5262ad9 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -144,6 +144,22 @@ class HomeController extends Controller SUM(b3::integer) as b3, SUM(minyak_jelantah::integer) as minyak ')->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'; diff --git a/app/Http/Controllers/SampahBelumTerkelolaController.php b/app/Http/Controllers/SampahBelumTerkelolaController.php index c81a31a..c375279 100644 --- a/app/Http/Controllers/SampahBelumTerkelolaController.php +++ b/app/Http/Controllers/SampahBelumTerkelolaController.php @@ -9,7 +9,7 @@ class SampahBelumTerkelolaController extends Controller { protected $template = 'modules.sampah-belum'; protected $route = 'modules.sampah-belum'; - protected $title = 'Sampah Belum Terkelola'; + protected $title = 'Timbulan Sampah'; /** * Display a listing of the resource. diff --git a/resources/views/modules/dashboard/admin.blade.php b/resources/views/modules/dashboard/admin.blade.php index 2d02243..c9a8f29 100644 --- a/resources/views/modules/dashboard/admin.blade.php +++ b/resources/views/modules/dashboard/admin.blade.php @@ -231,70 +231,26 @@
 Ranking Sekolah Pengolahan Sampah
-
-
-
-
-
-
SD NEGERI TOMANG 08 PAGI
- Jakarta Barat - Adiwiyata Provinsi -
-
-
80%
+ @foreach ($ranking_sekolah as $dataSekolah) +
+
+
+
+
+
{{ $dataSekolah->nama_sekolah }}
+ {{wilayah($dataSekolah->npsn)}} + {{levelAdiwiyata($dataSekolah->npsn)}} +
+
+
{{ $dataSekolah->total_pengelolaan_sampah }}%
+
-
-
-
-
-
-
-
SD NEGERI TOMANG 08 PAGI
- Jakarta Barat - Adiwiyata Provinsi -
-
-
80%
-
-
-
-
-
-
-
-
-
-
-
SD NEGERI TOMANG 08 PAGI
- Jakarta Barat - Adiwiyata Provinsi -
-
-
80%
-
-
-
-
-
-
-
-
-
-
-
SD NEGERI TOMANG 08 PAGI
- Jakarta Barat - Adiwiyata Provinsi -
-
-
80%
-
-
-
-
-
+ @endforeach + +
diff --git a/routes/web.php b/routes/web.php index bac63c5..39823fa 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,6 +23,12 @@ use App\Http\Controllers\StorageController; | 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('/storage-list-file',[StorageController::class,'storagelistfile'])->name('storagelistfile'); Route::get('s3/migration',[StorageController::class,'s3migration'])->name('s3migration');