update
parent
55f43593de
commit
9a630f6b66
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -115,6 +115,23 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="bg-primary text-white belumPernah {{@$kuesioner->level == 0 ? '' : 'd-none'}}">
|
||||
<td>Apakah sekolah anda sudah pernah mendapatkan informasi tentang Gerakan Peduli dan Berbudaya Lingkungan Hidup di Sekolah (GPBLHS) </td>
|
||||
</tr>
|
||||
<tr class="belumPernah {{@$kuesioner->level == 0 ? '' : 'd-none'}}">
|
||||
<td>
|
||||
<div class="custom-control custom-radio">
|
||||
<input type="radio" class="custom-control-input info_pblhs" id="radioGerakanPeduliBelum" value="1" {{@$kuesioner->info_pblhs == '1' ? 'checked' : ''}} name="info_pblhs">
|
||||
<label class="custom-control-label" for="radioGerakanPeduliBelum">Belum Pernah</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio mt-2">
|
||||
<input type="radio" class="custom-control-input info_pblhs" id="radioGerakanPeduliSudah" value="2" {{@$kuesioner->info_pblhs == '2' ? 'checked' : ''}} name="info_pblhs">
|
||||
<label class="custom-control-label" for="radioGerakanPeduliSudah">Sudah Pernah</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Belum Pernah -->
|
||||
<tr class="bg-primary text-white belumPernah {{@$kuesioner->level == 0 ? '' : 'd-none'}}">
|
||||
<td>Apakah sekolah anda sudah membentuk Tim Adiwiyata Sekolah?</td>
|
||||
|
@ -150,21 +167,7 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bg-primary text-white belumPernah {{@$kuesioner->level == 0 ? '' : 'd-none'}}">
|
||||
<td>Apakah sekolah anda sudah pernah mendapatkan informasi tentang Gerakan Peduli dan Berbudaya Lingkungan Hidup di Sekolah (PBLHS) </td>
|
||||
</tr>
|
||||
<tr class="belumPernah {{@$kuesioner->level == 0 ? '' : 'd-none'}}">
|
||||
<td>
|
||||
<div class="custom-control custom-radio">
|
||||
<input type="radio" class="custom-control-input" id="radioGerakanPeduliBelum" value="1" {{@$kuesioner->info_pblhs == '1' ? 'checked' : ''}} name="info_pblhs">
|
||||
<label class="custom-control-label" for="radioGerakanPeduliBelum">Belum Pernah</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio mt-2">
|
||||
<input type="radio" class="custom-control-input" id="radioGerakanPeduliSudah" value="2" {{@$kuesioner->info_pblhs == '2' ? 'checked' : ''}} name="info_pblhs">
|
||||
<label class="custom-control-label" for="radioGerakanPeduliSudah">Sudah Pernah</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="bg-primary text-white belumPernah {{@$kuesioner->level == 0 ? '' : 'd-none'}}">
|
||||
<td>Jika pernah, dari media apa mendapatkannya, dan sebutkan nama instansi penyelenggaranya ? </td>
|
||||
</tr>
|
||||
|
@ -178,12 +181,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="media[]" value="1" {{ in_array(1, @$selectedMediaValues) ? 'checked' : '' }} id="checkSosialisasi">
|
||||
<input type="checkbox" class="custom-control-input media" name="media[]" value="1" {{ in_array(1, @$selectedMediaValues) ? 'checked' : '' }} id="checkSosialisasi">
|
||||
<label class="custom-control-label" for="checkSosialisasi">Sosialisasi</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="media_text[sosialisasi]" value="{{ @$selectedMediaTexts['sosialisasi']->text ?? '' }}" class="form-control" placeholder="Tulis Instansi Penyelenggara">
|
||||
<input type="text" name="media_text[sosialisasi]" value="{{ @$selectedMediaTexts['sosialisasi']->text ?? '' }}" class="form-control media" placeholder="Tulis Instansi Penyelenggara">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -192,12 +195,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="media[]" value="2" {{ in_array(2, @$selectedMediaValues) ? 'checked' : '' }} id="checkBimtek">
|
||||
<input type="checkbox" class="custom-control-input media" name="media[]" value="2" {{ in_array(2, @$selectedMediaValues) ? 'checked' : '' }} id="checkBimtek">
|
||||
<label class="custom-control-label" for="checkBimtek">Bimtek</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="media_text[bimtek]" value="{{ @$selectedMediaTexts['bimtek']->text ?? '' }}" class="form-control" placeholder="Tulis Instansi Penyelenggara">
|
||||
<input type="text" name="media_text[bimtek]" value="{{ @$selectedMediaTexts['bimtek']->text ?? '' }}" class="form-control media" placeholder="Tulis Instansi Penyelenggara">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -206,12 +209,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="media[]" value="3" {{ in_array(3, @$selectedMediaValues) ? 'checked' : '' }} id="checkWebinar">
|
||||
<input type="checkbox" class="custom-control-input media" name="media[]" value="3" {{ in_array(3, @$selectedMediaValues) ? 'checked' : '' }} id="checkWebinar">
|
||||
<label class="custom-control-label" for="checkWebinar">Webinar</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="media_text[webinar]" value="{{ @$selectedMediaTexts['webinar']->text ?? '' }}" class="form-control" placeholder="Tulis Instansi Penyelenggara">
|
||||
<input type="text" name="media_text[webinar]" value="{{ @$selectedMediaTexts['webinar']->text ?? '' }}" class="form-control media" placeholder="Tulis Instansi Penyelenggara">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -220,12 +223,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="media[]" value="4" {{ in_array(4, @$selectedMediaValues) ? 'checked' : '' }} id="checkYoutube">
|
||||
<input type="checkbox" class="custom-control-input media" name="media[]" value="4" {{ in_array(4, @$selectedMediaValues) ? 'checked' : '' }} id="checkYoutube">
|
||||
<label class="custom-control-label" for="checkYoutube">Youtube</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="media_text[youtube]" value="{{ @$selectedMediaTexts['youtube']->text ?? '' }}" class="form-control" placeholder="Tulis Instansi Penyelenggara">
|
||||
<input type="text" name="media_text[youtube]" value="{{ @$selectedMediaTexts['youtube']->text ?? '' }}" class="form-control media" placeholder="Tulis Instansi Penyelenggara">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -234,12 +237,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="media[]" value="5" {{ in_array(5, @$selectedMediaValues) ? 'checked' : '' }} id="checkLain">
|
||||
<input type="checkbox" class="custom-control-input media" name="media[]" value="5" {{ in_array(5, @$selectedMediaValues) ? 'checked' : '' }} id="checkLain">
|
||||
<label class="custom-control-label" for="checkLain">Lain-lain</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="media_text[lainlain]" value="{{ @$selectedMediaTexts['lainlain']->text ?? '' }}" class="form-control" placeholder="Tulis Instansi Penyelenggara">
|
||||
<input type="text" name="media_text[lainlain]" value="{{ @$selectedMediaTexts['lainlain']->text ?? '' }}" class="form-control media" placeholder="Tulis Instansi Penyelenggara">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -254,12 +257,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="materi[]" value="1" {{ in_array(1, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriKebijakan">
|
||||
<input type="checkbox" class="custom-control-input materi" name="materi[]" value="1" {{ in_array(1, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriKebijakan">
|
||||
<label class="custom-control-label" for="checkMateriKebijakan">Kebijakan Gerakan PBLHS</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="materi_text[kebijakan]" class="form-control" placeholder="">
|
||||
<input type="text" name="materi_text[kebijakan]" class="form-control materi" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -268,12 +271,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="materi[]" value="2" {{ in_array(2, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriPerencanaan">
|
||||
<input type="checkbox" class="custom-control-input materi" name="materi[]" value="2" {{ in_array(2, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriPerencanaan">
|
||||
<label class="custom-control-label" for="checkMateriPerencanaan">Perencanaan Gerakan PBLHS</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="materi_text[perencanaan]" value="{{ @$selectedMateriTexts['perencanaan']->text ?? '' }}" class="form-control" placeholder="">
|
||||
<input type="text" name="materi_text[perencanaan]" value="{{ @$selectedMateriTexts['perencanaan']->text ?? '' }}" class="form-control materi" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -282,12 +285,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="materi[]" value="3" {{ in_array(3, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriPelaksanaan">
|
||||
<input type="checkbox" class="custom-control-input materi" name="materi[]" value="3" {{ in_array(3, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriPelaksanaan">
|
||||
<label class="custom-control-label" for="checkMateriPelaksanaan">Pelaksanaan Gerakan PBLHS</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="materi_text[pelaksanaan]" value="{{ @$selectedMateriTexts['pelaksanaan']->text ?? '' }}" class="form-control" placeholder="">
|
||||
<input type="text" name="materi_text[pelaksanaan]" value="{{ @$selectedMateriTexts['pelaksanaan']->text ?? '' }}" class="form-control materi" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -296,12 +299,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="materi[]" value="4" {{ in_array(4, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriPemantauan">
|
||||
<input type="checkbox" class="custom-control-input materi" name="materi[]" value="4" {{ in_array(4, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriPemantauan">
|
||||
<label class="custom-control-label" for="checkMateriPemantauan">Pemantauan dan Evaluasi Gerakan PBLHS</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="materi_text[pemantauan]" value="{{ @$selectedMateriTexts['pemantauan']->text ?? '' }}" class="form-control" placeholder="">
|
||||
<input type="text" name="materi_text[pemantauan]" value="{{ @$selectedMateriTexts['pemantauan']->text ?? '' }}" class="form-control materi" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -310,12 +313,12 @@
|
|||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="materi[]" value="5" {{ in_array(5, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriLain">
|
||||
<input type="checkbox" class="custom-control-input materi" name="materi[]" value="5" {{ in_array(5, @$selectedMateriValues) ? 'checked' : '' }} id="checkMateriLain">
|
||||
<label class="custom-control-label" for="checkMateriLain">Lain-lain</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="materi_text[lainlain]" value="{{ @$selectedMateriTexts['lainlain']->text ?? '' }}" class="form-control" placeholder="">
|
||||
<input type="text" name="materi_text[lainlain]" value="{{ @$selectedMateriTexts['lainlain']->text ?? '' }}" class="form-control materi" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -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
|
||||
|
|
|
@ -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']);
|
Loading…
Reference in New Issue