update
parent
2e73c06dae
commit
fc7422d683
|
|
@ -15,6 +15,124 @@ use Hash;
|
|||
|
||||
class AjaxController extends Controller
|
||||
{
|
||||
function exportusulanProvinsi(Request $request){
|
||||
if(session('kabupaten_id') != ''){
|
||||
$kuesioner = Kuesioner::where('level',1)->whereHas('sekolah',function($query){
|
||||
$query->where('ms_kabupaten_id',session('kabupaten_id'));
|
||||
})->orderBy('created_at','DESC');
|
||||
}else{
|
||||
$kuesioner = Kuesioner::where('level',1)->orderBy('created_at','DESC');
|
||||
}
|
||||
|
||||
if(@request()->kabupaten != 0){
|
||||
$kuesioner->whereHas('sekolah',function($query) use ($request){
|
||||
$query->where('ms_kabupaten_id',decode_id($request->kabupaten));
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->kecamatan != 0){
|
||||
$kuesioner->whereHas('sekolah',function($query){
|
||||
$query->where('ms_kecamatan_id',decode_id(request()->kecamatan));
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->tingkat){
|
||||
$kuesioner->whereHas('sekolah',function($query){
|
||||
$query->where('ms_tingkat_sekolah_id',request()->tingkat);
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->progress){
|
||||
$kuesioner->whereHas('kuesionerLog',function($query){
|
||||
$query->where('step',request()->progress);
|
||||
});
|
||||
}
|
||||
|
||||
$data['kuesioner'] = $kuesioner->get();
|
||||
$data['type'] = 'provinsi';
|
||||
$data['table'] = 'Export Data CSAP'.date('YmdHis');
|
||||
|
||||
return view('modules.export.usulan',$data);
|
||||
}
|
||||
function exportusulanKota(Request $request){
|
||||
if(session('kabupaten_id') != ''){
|
||||
$kuesioner = Kuesioner::where('level',0)->whereHas('sekolah',function($query){
|
||||
$query->where('ms_kabupaten_id',session('kabupaten_id'));
|
||||
})->orderBy('created_at','DESC');
|
||||
}else{
|
||||
$kuesioner = Kuesioner::where('level',0)->orderBy('created_at','DESC');
|
||||
}
|
||||
|
||||
if(@request()->kabupaten != 0){
|
||||
$kuesioner->whereHas('sekolah',function($query) use ($request){
|
||||
$query->where('ms_kabupaten_id',decode_id($request->kabupaten));
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->kecamatan != 0){
|
||||
$kuesioner->whereHas('sekolah',function($query){
|
||||
$query->where('ms_kecamatan_id',decode_id(request()->kecamatan));
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->tingkat){
|
||||
$kuesioner->whereHas('sekolah',function($query){
|
||||
$query->where('ms_tingkat_sekolah_id',request()->tingkat);
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->progress){
|
||||
$kuesioner->whereHas('kuesionerLog',function($query){
|
||||
$query->where('step',request()->progress);
|
||||
});
|
||||
}
|
||||
|
||||
$data['kuesioner'] = $kuesioner->get();
|
||||
$data['type'] = 'kota';
|
||||
$data['table'] = 'Export Data CSAK'.date('YmdHis');
|
||||
|
||||
return view('modules.export.usulan',$data);
|
||||
}
|
||||
function exportKuesioner(Request $request){
|
||||
|
||||
if(session('kabupaten_id') != ''){
|
||||
$kuesioner = Kuesioner::whereHas('sekolah',function($query){
|
||||
$query->where('ms_kabupaten_id',session('kabupaten_id'));
|
||||
});
|
||||
}else{
|
||||
$kuesioner = Kuesioner::where('tahun',date('Y'));
|
||||
}
|
||||
|
||||
|
||||
if(@request()->kabupaten != 0){
|
||||
$kuesioner->whereHas('sekolah',function($query) use ($request){
|
||||
$query->where('ms_kabupaten_id',decode_id($request->kabupaten));
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->kecamatan != 0){
|
||||
$kuesioner->whereHas('sekolah',function($query){
|
||||
$query->where('ms_kecamatan_id',decode_id(request()->kecamatan));
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->tingkat){
|
||||
$kuesioner->whereHas('sekolah',function($query){
|
||||
$query->where('ms_tingkat_sekolah_id',request()->tingkat);
|
||||
});
|
||||
}
|
||||
|
||||
if(@request()->progress){
|
||||
$kuesioner->whereHas('kuesionerLog',function($query){
|
||||
$query->where('step',request()->progress);
|
||||
});
|
||||
}
|
||||
|
||||
$data['kuesioner'] = $kuesioner->get();
|
||||
$data['table'] = 'Export Data '.date('YmdHis');
|
||||
|
||||
return view('modules.export.kuesioner',$data);
|
||||
}
|
||||
function authApi() {
|
||||
$curl = curl_init();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
header("Content-type: application/vnd.ms-excel");
|
||||
header("Content-Disposition: attachment; filename={$table}.xls");
|
||||
header("Pragma: no-cache");
|
||||
//dd($records);
|
||||
?>
|
||||
|
||||
<table border="1" width="100%">
|
||||
<thead>
|
||||
<tr style="text-align: center; font-weight:bold; vertical-align:middle;">
|
||||
<th>No</th>
|
||||
<th>Tahun</th>
|
||||
<th>NPSN</th>
|
||||
<th>Nama Sekolah</th>
|
||||
<th>Wilayah</th>
|
||||
<th>Kecamatan</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($kuesioner as $key => $row)
|
||||
<tr style="vertical-align:middle;">
|
||||
<td>{{ $key+1 }}</td>
|
||||
<td>{{ @$row->tahun }}</td>
|
||||
<td>{{ @$row->sekolah->npsn}}</td>
|
||||
<td>{{ @$row->sekolah->nama_sekolah }}</td>
|
||||
<td>{{ @$row->sekolah->kabupaten->name }}</td>
|
||||
<td>{{ @$row->sekolah->kecamatan->name }}</td>
|
||||
<td>{{ strip_tags(kuesionerLogStatus($row->KuesionerId)) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
header("Content-type: application/vnd.ms-excel");
|
||||
header("Content-Disposition: attachment; filename={$table}.xls");
|
||||
header("Pragma: no-cache");
|
||||
//dd($records);
|
||||
?>
|
||||
|
||||
<table border="1" width="100%">
|
||||
<thead>
|
||||
<tr style="text-align: center; font-weight:bold; vertical-align:middle;">
|
||||
<th rowspan="2">No</th>
|
||||
<th rowspan="2">Tahun</th>
|
||||
<th rowspan="2">NPSN</th>
|
||||
<th rowspan="2">Nama Sekolah</th>
|
||||
<th rowspan="2">Wilayah</th>
|
||||
<th colspan="{{ $type == 'kota' ? '2' : '3' }}">Pemenuhan Kriteria</th>
|
||||
<th rowspan="2">Status</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Sekolah</th>
|
||||
@if ($type == 'kota')
|
||||
<th>Kota</th>
|
||||
@else
|
||||
<th>Kota</th>
|
||||
<th>Provinsi</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($kuesioner as $key => $row)
|
||||
<tr style="vertical-align:middle;">
|
||||
<td>{{ $key+1 }}</td>
|
||||
<td>{{ @$row->tahun }}</td>
|
||||
<td>{{ @$row->sekolah->npsn}}</td>
|
||||
<td>{{ @$row->sekolah->nama_sekolah }}</td>
|
||||
<td>{{ @$row->sekolah->kabupaten->name }}</td>
|
||||
<td>{{getNilaiAll('sekolah',$row->ms_sekolah_id,$row->KuesionerId)}}</td>
|
||||
@if ($type == 'kota')
|
||||
<td>{{getNilaiAll('kota',$row->ms_sekolah_id,$row->KuesionerId)}}</td>
|
||||
@else
|
||||
<td>{{getNilaiAll('kota',$row->ms_sekolah_id,$row->KuesionerId)}}</td>
|
||||
<td>{{getNilaiAll('provinsi',$row->ms_sekolah_id,$row->KuesionerId)}}</td>
|
||||
@endif
|
||||
<td>{{ strip_tags(kuesionerLogStatus($row->KuesionerId)) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12 mb-2 d-none" id="filter">
|
||||
<div class="card">
|
||||
<form action="{{ url('export/kuesioner/') }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<div class="card-body">
|
||||
<h5 class="mb-4"><i class="fal fa-filter"></i> Filter</h5>
|
||||
<div class="row" id="pencarian">
|
||||
|
|
@ -89,7 +91,13 @@
|
|||
|
||||
<div class="w-100">
|
||||
<div class="form-group">
|
||||
<button id="ok" class="btn btn-success btn-block"><i class="fal fa-search"></i> Cari Data</button>
|
||||
<a id="ok" class="btn btn-primary text-white btn-block"><i class="fal fa-search"></i> Cari Data</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-100">
|
||||
<div class="form-group">
|
||||
<button type="sumbit" class="btn btn-export btn-success btn-block"><i class="fal fa-download"></i> Export Data</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -99,6 +107,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
|
|
@ -107,7 +116,6 @@
|
|||
<div class="panel-content">
|
||||
<div id="toolbar">
|
||||
<a class="btn btn-secondary btn-filter btn-sm text-white"><i class="fal fa-filter text-white"></i> Filter</a>
|
||||
<a class="btn btn-success btn-export btn-sm text-white"><i class="fal fa-download text-white"></i> Export</a>
|
||||
</div>
|
||||
|
||||
<table class="table w-100 wrap"
|
||||
|
|
@ -178,33 +186,6 @@
|
|||
$('#filter').toggleClass('d-none');
|
||||
});
|
||||
|
||||
$('.btn.export').on('click',function{
|
||||
request = $.ajax({
|
||||
url: base_url,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
type: "GET",
|
||||
});
|
||||
|
||||
// Callback handler that will be called on success
|
||||
request.done(function(response, textStatus, jqXHR){
|
||||
console.log(response);
|
||||
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
window.location.href = '{{url("/kuesioner")}}';
|
||||
history.pushState(null, null, location.href);
|
||||
window.onpopstate = function () {
|
||||
history.go(1);
|
||||
};
|
||||
});
|
||||
|
||||
// Callback handler that will be called on failure
|
||||
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||
toastr.error(
|
||||
"Gagal "+textStatus, errorThrown
|
||||
);
|
||||
});
|
||||
});
|
||||
$(function() {
|
||||
$ok.click(function() {
|
||||
$table.bootstrapTable('refresh');
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12 mb-2 d-none" id="filter">
|
||||
<div class="card">
|
||||
<form action="{{ url('export/usulanKota') }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<div class="card-body">
|
||||
<h5 class="mb-4"><i class="fal fa-filter"></i> Filter</h5>
|
||||
<div class="row" id="pencarian">
|
||||
|
|
@ -89,7 +91,13 @@
|
|||
|
||||
<div class="w-100">
|
||||
<div class="form-group">
|
||||
<button id="ok" class="btn btn-success btn-block"><i class="fal fa-search"></i> Cari Data</button>
|
||||
<a id="ok" class="btn btn-primary text-white btn-block"><i class="fal fa-search"></i> Cari Data</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-100">
|
||||
<div class="form-group">
|
||||
<button type="sumbit" class="btn btn-export btn-success btn-block"><i class="fal fa-download"></i> Export Data</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -99,6 +107,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12 mb-2 d-none" id="filter">
|
||||
<div class="card">
|
||||
<form action="{{ url('export/usulanProvinsi') }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<div class="card-body">
|
||||
<h5 class="mb-4"><i class="fal fa-filter"></i> Filter</h5>
|
||||
<div class="row" id="pencarian">
|
||||
|
|
@ -89,7 +91,13 @@
|
|||
|
||||
<div class="w-100">
|
||||
<div class="form-group">
|
||||
<button id="ok" class="btn btn-success btn-block"><i class="fal fa-search"></i> Cari Data</button>
|
||||
<a id="ok" class="btn btn-primary text-white btn-block"><i class="fal fa-search"></i> Cari Data</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-100">
|
||||
<div class="form-group">
|
||||
<button type="sumbit" class="btn btn-export btn-success btn-block"><i class="fal fa-download"></i> Export Data</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -99,6 +107,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ Route::post('profile-sekolah',[ProfileController::class,'store'])->name('profile
|
|||
Route::post('getForm',[AjaxController::class,'getForm'])->name('getForm');
|
||||
Route::post('getSekolahSK',[AjaxController::class,'getSekolahSK'])->name('getSekolahSK');
|
||||
Route::post('getSekolahUsulan',[AjaxController::class,'getSekolahUsulan'])->name('getSekolahUsulan');
|
||||
Route::post('export/kuesioner',[AjaxController::class,'exportKuesioner'])->name('exportKuesioner');
|
||||
Route::post('export/usulanKota',[AjaxController::class,'exportusulanKota'])->name('exportusulanKota');
|
||||
Route::post('export/usulanProvinsi',[AjaxController::class,'exportusulanProvinsi'])->name('exportusulanProvinsi');
|
||||
|
||||
|
||||
Route::name('konten.')->prefix('konten')->group(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue