diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php
index 9340fc4..1a493fb 100644
--- a/app/Http/Controllers/Api/ApiController.php
+++ b/app/Http/Controllers/Api/ApiController.php
@@ -285,4 +285,34 @@ class ApiController extends Controller
'data' => $dataScrapping,
]);
}
+
+ public function testScrapping()
+ {
+ $client = new Client();
+
+
+ $url = "https://ww1.anoboy.app/2016/10/one-piece-indonesia";
+
+ $response = Http::timeout(300)->withoutVerifying()->get($url);
+ $html = $response->body();
+
+ $crawler = new Crawler($html);
+ $table = $crawler->filter('table')->first();
+
+ $episodes = [];
+ $crawler->filter('ul#lcp_instance_0 li a')->each(function ($node) use (&$episodes) {
+ $title = $node->text();
+ $url = $node->attr('href');
+
+ // Hanya ambil link yang berkaitan dengan One Piece
+ // if (stripos($title, 'One Piece') !== false) {
+ $episodes[] = [
+ 'title' => $title,
+ 'url' => $url,
+ ];
+ // }
+ });
+
+ return response()->json($episodes);
+ }
}
diff --git a/app/Http/Controllers/KuesionerController.php b/app/Http/Controllers/KuesionerController.php
index fddb15e..f9ef965 100644
--- a/app/Http/Controllers/KuesionerController.php
+++ b/app/Http/Controllers/KuesionerController.php
@@ -320,6 +320,28 @@ class KuesionerController extends Controller
}
}
+ //rumus level adiwiyata
+ $level = 0;
+ if($request->level == 0){
+ if(($request->tim_adiwiyata == 1) && ($request->info_pblhs == 1)){
+ $level = 0;
+ }elseif(($request->tim_adiwiyata == 1) || ($request->info_pblhs == 2)){
+ $level = 1;
+ }elseif(($request->tim_adiwiyata == 2) || ($request->info_pblhs == 1)){
+ $level = 1;
+ }else{
+ $level = 2;
+ }
+ }elseif($request->level == 1){
+ $level = 3;
+ }elseif($request->level == 2){
+ $level = 4;
+ }elseif($request->level == 3){
+ $level = 5;
+ }elseif($request->level == 4){
+ $level = 6;
+ }
+
$insert = new Kuesioner;
$insert->ms_sekolah_id = session('sekolah_id');
$insert->created_by = auth()->user()->id;
diff --git a/resources/views/modules/kuesioner/form.blade.php b/resources/views/modules/kuesioner/form.blade.php
index 1844067..07275eb 100644
--- a/resources/views/modules/kuesioner/form.blade.php
+++ b/resources/views/modules/kuesioner/form.blade.php
@@ -115,6 +115,23 @@
+
+
+ Apakah sekolah anda sudah pernah mendapatkan informasi tentang Gerakan Peduli dan Berbudaya Lingkungan Hidup di Sekolah (GPBLHS) |
+
+
+
+
+ info_pblhs == '1' ? 'checked' : ''}} name="info_pblhs">
+
+
+
+ info_pblhs == '2' ? 'checked' : ''}} name="info_pblhs">
+
+
+ |
+
+
Apakah sekolah anda sudah membentuk Tim Adiwiyata Sekolah? |
@@ -150,21 +167,7 @@
-
- Apakah sekolah anda sudah pernah mendapatkan informasi tentang Gerakan Peduli dan Berbudaya Lingkungan Hidup di Sekolah (PBLHS) |
-
-
-
-
- info_pblhs == '1' ? 'checked' : ''}} name="info_pblhs">
-
-
-
- info_pblhs == '2' ? 'checked' : ''}} name="info_pblhs">
-
-
- |
-
+
Jika pernah, dari media apa mendapatkannya, dan sebutkan nama instansi penyelenggaranya ? |
@@ -178,12 +181,12 @@
-
+
@@ -192,12 +195,12 @@
-
+
@@ -206,12 +209,12 @@
-
+
@@ -220,12 +223,12 @@
-
+
@@ -234,12 +237,12 @@
-
+
@@ -254,12 +257,12 @@
-
+
@@ -268,12 +271,12 @@
-
+
@@ -282,12 +285,12 @@
-
+
@@ -296,12 +299,12 @@
-
+
@@ -310,12 +313,12 @@
-
+
@@ -512,6 +515,16 @@
}
});
+ $('.info_pblhs').on('change',function(){
+ if($(this).val() == 1){
+ $('.media').attr('disabled',true);
+ $('.materi').attr('disabled',true);
+ }else{
+ $('.media').removeAttr('disabled');
+ $('.materi').removeAttr('disabled');
+ }
+ });
+
$('#btn-save').on('click',function(e){
e.preventDefault();
@@ -532,8 +545,8 @@
if (
$('input[name="info_pblhs"]:checked').length > 0 && // Radio button
- $('input[name="media[]"]:checked').length > 0 && // Checkbox
- $('input[name="materi[]"]:checked').length > 0 &&
+ // $('input[name="media[]"]:checked').length > 0 && // Checkbox
+ // $('input[name="materi[]"]:checked').length > 0 &&
$('input[name="komitmen"]:checked').length > 0 &&
$('input[name="kegiatan_lingkungan[]"]:checked').length > 0 &&
$('input[name="pihak_kegiatan_lingkungan[]"]:checked').length > 0
diff --git a/routes/api.php b/routes/api.php
index 541e9ef..d9a45c9 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -27,4 +27,6 @@ Route::get('getSekolah',[ApiController::class,'getSekolah']);
Route::get('/scrappingMI', [ApiController::class, 'scrappingMI']);
Route::get('/scrappingMA', [ApiController::class, 'scrappingMA']);
+Route::get('/testScrapping', [ApiController::class, 'testScrapping']);
+
// Route::get('getKabupaten',[ApiController::class,'getKabupaten']);
\ No newline at end of file