Commit 88a3593f by novanbagus

update filter

parent 263f79d2
<?php
namespace App\Exports;
use App\User;
use App\Models\Kota;
use App\Models\Provinsi;
use App\Models\Kecamatan;
use App\Models\Kelurahan;
use App\Models\Kuesioner;
use App\Models\UsersDetil;
use App\Models\KuesionerPage;
use App\Models\KuesionerField;
use App\Models\KuesionerAnswer;
use App\Models\KuesionerSection;
use Illuminate\Support\Facades\DB;
use App\Models\KuesionerAnswerDetil;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
class KelompokExport implements FromCollection,WithHeadings,ShouldAutoSize,WithTitle
{
/**
* @return \Illuminate\Support\Collection
*/
public function __construct($fakultas,$prodi,$lulusan,$group)
{
$this->fakultas = $fakultas;
$this->prodi = $prodi;
$this->lulusan = $lulusan;
$this->group = $group;
}
public function title(): string
{
return 'Users';
}
public function collection()
{
$statement = " IS_ACTIVE = '1' ";
if($this->fakultas != "0")
{
$statement .= " AND b.fakultas_id = '".$this->fakultas."'";
}
if($this->prodi != "0" && $this->prodi != "")
{
$statement .= " AND b.prodi_id = '".$this->prodi."'";
}
if($this->lulusan != "0")
{
$statement .= " AND b.tahun_lulus = '".$this->lulusan."'";
}
if($this->group != "0")
{
$statement .= " AND role = '".$this->group."'";
}
$data = User::join('users_detil as b', 'users.id', '=', 'b.users_id')
->join('users_group as e', 'users.role', '=', 'e.nama')
->leftjoin('fakultas as c', 'b.fakultas_id', '=', 'c.id')
->leftjoin('prodi as d', 'b.prodi_id', '=', 'd.id')
->whereRaw($statement)
->select('nim', 'users.email', 'users.name', 'c.nama as nama_fakultas', 'd.nama as nama_prodi', 'tahun_lulus', 'b.no_tlp')
->get();
return collect($data);
}
public function headings(): array
{
return ["NIM", "Email", "Nama", "Fakultas", "Prodi", "Lulusan", "No HP"];
}
}
......@@ -203,4 +203,24 @@ class KelompokController extends Controller
return redirect()->route('mahasiswa.kelompok.index');
}
// public function cetak_kelompok(Request $request)
// {
// $fakultas = $request->fakultas;
// $prodi = $request->prodi;
// $lulusan = $request->lulusan;
// $group = $request->group;
// if(isset($this->rUserDetil->fakultas_id))
// {
// $fakultas = $this->rUserDetil->fakultas_id;
// }
// if(isset($this->rUserDetil->prodi_id))
// {
// $prodi = $this->rUserDetil->prodi_id;
// }
// return Excel::download(new UsersExport($fakultas, $prodi, $lulusan, $group), 'users_export.xlsx');
// }
}
......@@ -9,9 +9,11 @@ use Auth;
use Uuid;
use Alert;
use Crypt;
use App\Models\Jenis;
use App\Models\Periode;
use App\Models\Kelompok;
use Illuminate\Http\Request;
use App\Models\KelompokDetail;
use App\Http\Controllers\Controller;
......@@ -19,11 +21,15 @@ class KelompokController extends Controller
{
public function index()
{
return view('backend.operator.kelompok.index')->withTitle('Daftar Kelompok');
$periode = Periode::query()->get();
return view('backend.operator.kelompok.index', compact('periode'))->withTitle('Daftar Kelompok');
}
/* AJAX request */
public function getData(Request $request){
// parameter
$status = $request->get('status');
$tahun= $request->get('tahun');
## Read value
$draw = $request->get('draw');
......@@ -42,6 +48,19 @@ class KelompokController extends Controller
// Total records
$statementGlobal = " STATUS_HAPUS = '0' ";
if($status != "0")
{
// dikurang 1 karena di view mulai dari 0 sedangkan 0 itu menunggu persetujuan
$status = $status - 1;
$statementGlobal .= " AND STATUS = '".$status."'";
}
if($tahun != "0")
{
$statementGlobal .= " AND TO_CHAR(CREATED_AT, 'YYYY') = '".$tahun."'";
}
$totalRecords = Kelompok::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$statement = " AND (UPPER(NAMA_DOSEN) LIKE '%".$searchValue."%') ";
......
......@@ -10,8 +10,10 @@ use Uuid;
use Alert;
use Crypt;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Models\Jenis;
use App\Models\Periode;
use Illuminate\Http\Request;
use App\Models\DaftarProposal;
use App\Http\Controllers\Controller;
......@@ -19,11 +21,17 @@ class ProposalController extends Controller
{
public function index()
{
return view('backend.operator.proposal.index')->withTitle('Daftar Proposal');
$periode = Periode::query()->get();
$jenis = Jenis::query()->where('status_hapus', '0')->get();
return view('backend.operator.proposal.index', compact('periode', 'jenis'))->withTitle('Daftar Proposal');
}
/* AJAX request */
public function getData(Request $request){
// parameter
$jenis= $request->get('jenis');
$status = $request->get('status');
$tahun= $request->get('tahun');
## Read value
$draw = $request->get('draw');
......@@ -42,6 +50,24 @@ class ProposalController extends Controller
// Total records
$statementGlobal = " STATUS_HAPUS = '0' ";
if($jenis != "0")
{
$statementGlobal .= " AND JENIS_ID = '".$jenis."'";
}
if($status != "0")
{
// dikurang 1 karena di view mulai dari 0 sedangkan 0 itu menunggu persetujuan
$status = $status - 1;
$statementGlobal .= " AND STATUS = '".$status."'";
}
if($tahun != "0")
{
$statementGlobal .= " AND PERIODE = '".$tahun."'";
}
$totalRecords = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$statement = " AND (UPPER(JUDUL) LIKE '%".$searchValue."%') ";
......@@ -83,7 +109,7 @@ class ProposalController extends Controller
elseif($status == '2')
$keterangan = '<span class="badge bg-danger">Ditolak Dosen</span>';
else
$keterangan = '<span class="badge bg-warning">Menunngu Persetujuan Dosen</span>';
$keterangan = '<span class="badge bg-warning">Menunggu Persetujuan Dosen</span>';
}
$keterangan .= "<br><span class='badge bg-info'>Upload Proposal Pada : ".$date_upload." WIB</span>";
......
......@@ -30,6 +30,38 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-4">
<div class="row">
<label class="col-sm-3 col-form-label">Status : </label>
<div class="col-sm-6">
<select class="form-select" name="reqStatus" id="reqStatus">
<option value="0">Semua</option>
<option value="1">Menunggu Persetujuan</option>
<option value="2">Disetujui</option>
<option value="3">Ditolak</option>
</select>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row">
<label class="col-sm-3 col-form-label">Tahun : </label>
<div class="col-sm-6">
<select class="form-select" name="reqTahun" id="reqTahun">
<option value="0">Semua</option>
@foreach ($periode as $res)
<option value="{{ $res->nama }}">{{ $res->nama }}</option>
@endforeach
</select>
</select>
</div>
</div>
</div>
</div>
<br>
{!! csrf_field() !!}
<table id="example" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
......@@ -85,13 +117,24 @@
@section('js')
<script>
$("#reqStatus, #reqTahun").select2({
placeholder: "Semua",
allowClear: true
});
$(document).ready(function(){
// DataTable
var oTable = $('#example').DataTable({
processing: true,
serverSide: true,
ajax: {
"url" : "{{route('operator.getKelompok')}}"
"url" : "{{route('operator.getKelompok')}}",
"data" : function ( data )
{
data.status = $("#reqStatus").val();
data.tahun = $("#reqTahun").val();
}
},
columns: [
{ data: 'kelompok_id' },
......@@ -111,6 +154,10 @@
}
]
});
$('#reqStatus, #reqTahun').change(function(){
oTable.draw();
});
});
$(document).ready(function(){
......@@ -141,5 +188,15 @@
});
});
function cetak() {
var _token = $('input[name="_token"]').val();
var fakultas = $("#reqFakultas").val();
var prodi = $("#reqProdi").val();
var lulusan = $("#reqLulusan").val();
var group = $("#reqGroup").val();
window.open('{{url("/admin/cetak_users/")}}?fakultas='+fakultas+'&prodi='+prodi+'&lulusan='+lulusan+'&group='+group+'&_token='+_token, '_blank');
};
</script>
@endsection
......@@ -30,6 +30,51 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-4">
<div class="row">
<label class="col-sm-3 col-form-label">Jenis PKM : </label>
<div class="col-sm-6">
<select class="form-select" name="reqJenisPkm" id="reqJenisPkm">
<option value="0">Semua</option>
@foreach ($jenis as $res)
<option value="{{ $res->jenis_id }}">{{ $res->nama }}</option>
@endforeach
</select>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row">
<label class="col-sm-3 col-form-label">Status : </label>
<div class="col-sm-6">
<select class="form-select" name="reqStatus" id="reqStatus">
<option value="0">Semua</option>
<option value="1">Menunggu Persetujuan Dosen</option>
<option value="2">Disetujui Dosen</option>
<option value="3">Ditolak Dosen</option>
</select>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row">
<label class="col-sm-3 col-form-label">Tahun : </label>
<div class="col-sm-6">
<select class="form-select" name="reqTahun" id="reqTahun">
<option value="0">Semua</option>
@foreach ($periode as $res)
<option value="{{ $res->nama }}">{{ $res->nama }}</option>
@endforeach
</select>
</select>
</div>
</div>
</div>
</div>
<br>
<table id="example" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
......@@ -56,13 +101,25 @@
@section('js')
<script>
$("#reqJenisPkm, #reqStatus, #reqTahun").select2({
placeholder: "Semua",
allowClear: true
});
$(document).ready(function(){
// DataTable
var oTable = $('#example').DataTable({
processing: true,
serverSide: true,
ajax: {
"url" : "{{route('operator.getProposal')}}"
"url" : "{{route('operator.getProposal')}}",
"data" : function ( data )
{
data.jenis = $("#reqJenisPkm").val();
data.status = $("#reqStatus").val();
data.tahun = $("#reqTahun").val();
}
},
columns: [
{ data: 'proposal_id' },
......@@ -82,6 +139,10 @@
}
]
});
$('#reqJenisPkm, #reqStatus, #reqTahun').change(function(){
oTable.draw();
});
});
$(document).ready(function(){
......
......@@ -142,6 +142,7 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route::resource('kelompok', KelompokController::class);
Route::get('getKelompok', [KelompokController::class, 'getData'])->name('getKelompok');
Route::get('getDetilKelompok', [KelompokController::class, 'getDetil'])->name('getDetilKelompok');
Route::get('cetak_kelompok', [KelompokController::class, 'cetak_kelompok'])->name('cetak_users');
Route::resource('proposal', ProposalController::class);
Route::get('getProposal', [ProposalController::class, 'getData'])->name('getProposal');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment