Commit 4f01aa39 by Siti Aisah

add filter status kategori

parent 1dfe0c6e
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use App\Models\Admin\Pengajuan; use App\Models\Admin\Pengajuan;
use Exception; use Exception;
use Storage; use Storage;
use Session;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
...@@ -16,8 +17,34 @@ ...@@ -16,8 +17,34 @@
class TransaksiController extends Controller class TransaksiController extends Controller
{ {
public function index() { public function index(Request $request) {
Session::put('status', $request->status);
if(empty(Session::get('status'))) {
$pengusul = DB::table('bantuan_pengusul')->get(); $pengusul = DB::table('bantuan_pengusul')->get();
} else {
$pengajuan = DB::table('tr_pengajuan')->select('id_pengajuan')->get();
foreach($pengajuan as $p){
$list[$p->id_pengajuan] = $p->id_pengajuan;
}
if(Session::get('status') == '1'){
$pengusul = DB::table('bantuan_pengusul')->whereIn('id_pengajuan',$list)->get();
}elseif(Session::get('status') == '2'){
$pengusul = DB::table('bantuan_pengusul')->whereNotIn('id_pengajuan',$list)->get();
}
}
$kategori = DB::table('ms_kategori')->orderBy('kode_kategori','asc')->get(); $kategori = DB::table('ms_kategori')->orderBy('kode_kategori','asc')->get();
$data = [ $data = [
...@@ -32,7 +59,7 @@ public function store(Request $request){ ...@@ -32,7 +59,7 @@ public function store(Request $request){
$rule = [ $rule = [
'kategori' => 'required', 'kategori' => 'required',
'file_ec' => 'required', 'file_ec' => 'required|mimes:pdf|max:3072',
'nosurat' => 'required' 'nosurat' => 'required'
]; ];
...@@ -40,22 +67,27 @@ public function store(Request $request){ ...@@ -40,22 +67,27 @@ public function store(Request $request){
DB::beginTransaction(); DB::beginTransaction();
// if($request->hasFile('file_ec')){ try{
// $file = $request->file('file_ec');
// $filename = $file->getClientOriginalName();
// Storage::disk('uploads')->put('sipeka/'.$filename, file_get_contents($file->getRealPath())); if($request->hasFile('file_ec')){
// } $file = $request->file('file_ec');
$filename = $file->getClientOriginalName();
$path_dir = 'sipeka/file/';
$move = $request->file('file_ec')->move($path_dir,$filename);
// $cek = Storage::disk('uploads')->put('sipeka/'.$filename, file_get_contents($file->getRealPath()));
// dd($cek);
}
try{
$transaksi = [ $transaksi = [
'id_pengajuan' => $request->idpengajuan, 'id_pengajuan' => $request->idpengajuan,
'judul' => $request->judul, 'judul' => $request->judul,
'pengusul' => $request->pengusul, 'peneliti' => $request->peneliti,
'klasifikasi' => $request->klasifikasi, 'klasifikasi' => $request->klasifikasi,
'tahun' => $request->tahun, 'tahun' => $request->tahun,
'id_kategori' => $request->kategori, 'id_kategori' => $request->kategori,
// 'file_ec' => $filename, 'file_ec' => $filename,
'no_sk' => $request->nosurat, 'no_sk' => $request->nosurat,
]; ];
...@@ -67,6 +99,7 @@ public function store(Request $request){ ...@@ -67,6 +99,7 @@ public function store(Request $request){
foreach($reviewer as $r){ foreach($reviewer as $r){
$isdm = DB::connection('isdm')->table('v_detil_pegawai')->where('noktp',$r->nik)->select('namalengkap','nip')->first(); $isdm = DB::connection('isdm')->table('v_detil_pegawai')->where('noktp',$r->nik)->select('namalengkap','nip')->first();
if(!empty($isdm)){
$saku = [ $saku = [
'id_pengajuan' => $hasil->id, 'id_pengajuan' => $hasil->id,
...@@ -75,8 +108,16 @@ public function store(Request $request){ ...@@ -75,8 +108,16 @@ public function store(Request $request){
'nip' => $isdm->nip 'nip' => $isdm->nip
]; ];
Penelaah::query()->create($saku); } else {
$saku = [
'id_pengajuan' => $hasil->id,
'nik' => $r->nik,
'nama' => $r->penelaah,
'nip' => 'NIK belum terdaftar di ISDM. Silakan update ke Kepegawaian.'
];
}
Penelaah::query()->create($saku);
} }
DB::commit(); DB::commit();
......
...@@ -4,17 +4,14 @@ ...@@ -4,17 +4,14 @@
class ValidationRule{ class ValidationRule{
const WARNING = [ const WARNING = [
'required' => 'can not be empty',
'numeric' => 'must be a number',
'string' => 'must be a string', 'string' => 'must be a string',
'email' => 'tidak valid', 'max' => 'must be maximum',
'mimes' => 'tipe file tidak sesuai', 'min' => 'must be minimum',
'unique' => 'must be unique', 'email' => 'is invalid',
'required' => 'tidak boleh kosong', 'mimes' => 'file type must pdf',
'unique' => 'sudah digunakan', 'unique' => 'must be unique'
'numeric' => 'harus berupa nomor',
'max' => 'tidak boleh lebih dari',
'min' => 'tidak boleh kurang dari',
'before_or_equal' => 'maksimal hari ini',
'after_or_equal' => 'minimal hari ini',
]; ];
public static function getErrorMessage($validationRules) { public static function getErrorMessage($validationRules) {
......
...@@ -19,7 +19,7 @@ class Pengajuan extends Model ...@@ -19,7 +19,7 @@ class Pengajuan extends Model
'id', 'id',
'id_pengajuan', 'id_pengajuan',
'judul', 'judul',
'pengusul', 'peneliti',
'klasifikasi', 'klasifikasi',
'tahun', 'tahun',
'id_kategori', 'id_kategori',
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
<table id="zero-config" class="table table-hover" style="width:100%"> <table id="zero-config" class="table table-hover" style="width:100%">
<thead> <thead>
<tr> <tr>
<th>No. Pengajuan</th> <th>Id. Pengajuan</th>
<th style="text-align: left">File SK</th> <th style="text-align: left">File SK</th>
<th style="text-align: left">Nama</th> <th style="text-align: left">Nama/NIP</th>
<th style="text-align: left">Judul</th> <th style="text-align: left">Judul</th>
<th style="text-align: left">Tahun</th> <th style="text-align: left">Tahun</th>
<th style="text-align: left">Klasifikasi</th> <th style="text-align: left">Klasifikasi</th>
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
<tr> <tr>
<td>{{ $pengajuan->id_pengajuan }}</td> <td>{{ $pengajuan->id_pengajuan }}</td>
<td style="text-align: left">SURAT</td> <td style="text-align: left">SURAT</td>
<td style="text-align: left">{{ $item->nama }}</td> <td style="text-align: left">{{ $item->nama }}<br>
<strong>{{ $item->nip }}</strong></td>
<td style="text-align: left">{{ $pengajuan->judul }}</td> <td style="text-align: left">{{ $pengajuan->judul }}</td>
<td style="text-align: left">{{ $pengajuan->tahun }}</td> <td style="text-align: left">{{ $pengajuan->tahun }}</td>
<td style="text-align: left">{{ $pengajuan->klasifikasi }}</td> <td style="text-align: left">{{ $pengajuan->klasifikasi }}</td>
......
...@@ -22,6 +22,37 @@ ...@@ -22,6 +22,37 @@
</div> --}} </div> --}}
</div> </div>
</div> </div>
<div class="row">
<div class="panel panel-info">
<div class="panel-body">
<form action="{{ route('transaksi.index') }}" method="GET">
<div class="row">
<div class="col-md-3">
<label>Status Kategori</label>
<select name="status" class="form-control">
<option value="">Semua</option>
<option value="1" @if( Session::get('status') == '1') selected="selected" @endif>SUDAH</option>
<option value="2" @if( Session::get('status') =='2') selected="selected" @endif>BELUM</option>
</select>
</div>
{{-- <div class="col-md-3">
<label>Kategori</label>
<select name="kategori" class="form-control">
<option value="">Pilih</option>
@foreach($kategori as $k)
<option value="{{ $k->id }}" @if( Session::get('kategori') == $k->id) selected="selected" @endif>{{ $k->kode_kategori }} - {{ $k->nama_kategori }}</option>
@endforeach
</select>
</div> --}}
<div class="col-md-2">
<br>
<button class="btn btn-info pull-lefts">Cari</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div> </div>
</div> </div>
...@@ -29,9 +60,12 @@ ...@@ -29,9 +60,12 @@
<table id="zero-config" class="table table-hover" style="width:100%"> <table id="zero-config" class="table table-hover" style="width:100%">
<thead> <thead>
<tr> <tr>
@php
$no = 1;
@endphp
<th>No.</th> <th>No.</th>
<th style="text-align: left">Judul</th> <th style="text-align: left">Judul</th>
<th style="text-align: left">Pengusul</th> <th style="text-align: left">Peneliti</th>
<th style="text-align: left">Tahun</th> <th style="text-align: left">Tahun</th>
<th style="text-align: left">Reviewer</th> <th style="text-align: left">Reviewer</th>
<th style="text-align: left">Klasifikasi</th> <th style="text-align: left">Klasifikasi</th>
...@@ -41,9 +75,9 @@ ...@@ -41,9 +75,9 @@
<tbody> <tbody>
@foreach($pengusul as $item) @foreach($pengusul as $item)
<tr> <tr>
<td>{{ $item->id_pengajuan }}</td> <td>{{ $no }}</td>
<td style="text-align: left">{{ $item->judul }}</td> <td style="text-align: left">{{ $item->judul }}</td>
<td style="text-align: left">{{ $item->pengusul }}</td> <td style="text-align: left">{{ $item->peneliti_utama }}</td>
<td style="text-align: left">{{ date('Y',strtotime($item->tanggal_keputusan)) }}</td> <td style="text-align: left">{{ date('Y',strtotime($item->tanggal_keputusan)) }}</td>
@php @php
$penelaah = DB::table('bantuan_penelaah')->where('id_pengajuan', $item->id_pengajuan)->get(); $penelaah = DB::table('bantuan_penelaah')->where('id_pengajuan', $item->id_pengajuan)->get();
...@@ -79,7 +113,7 @@ ...@@ -79,7 +113,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body pb-5 px-sm-4 mx-50"> <div class="modal-body pb-5 px-sm-4 mx-50">
<h1 class="address-title text-center mb-1" id="addNewAddressTitle">Update Kategori Pengusul</h1> <h1 class="address-title text-center mb-1" id="addNewAddressTitle">Update Kategori Peneliti</h1>
<div class="row"> <div class="row">
<input type="hidden" name="idpengajuan" value="{{ $item->id_pengajuan }}"> <input type="hidden" name="idpengajuan" value="{{ $item->id_pengajuan }}">
<div class="col-md-12"> <div class="col-md-12">
...@@ -87,8 +121,8 @@ ...@@ -87,8 +121,8 @@
<input type="textarea" class="form-control" id="judul" name="judul" value="{{ $item->judul }}" readonly /> <input type="textarea" class="form-control" id="judul" name="judul" value="{{ $item->judul }}" readonly />
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<label class="form-label" for="pengusul">Pengusul</label> <label class="form-label" for="peneliti">Peneliti</label>
<input type="text" class="form-control" id="pengusul" name="pengusul" value="{{ $item->pengusul }}" readonly /> <input type="text" class="form-control" id="peneliti" name="peneliti" value="{{ $item->peneliti_utama }}" readonly />
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label class="form-label" for="tahun">Tahun</label> <label class="form-label" for="tahun">Tahun</label>
...@@ -99,7 +133,7 @@ ...@@ -99,7 +133,7 @@
<input type="text" class="form-control" id="klasifikasi" name="klasifikasi" value="{{ $item->klasifikasi }}" readonly /> <input type="text" class="form-control" id="klasifikasi" name="klasifikasi" value="{{ $item->klasifikasi }}" readonly />
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label class="form-label" for="kategori">Kategori Pengusul</label> <label class="form-label" for="kategori">Kategori Peneliti</label>
<select class="form-control" id="kategori" name="kategori" data-msg="Pilih Kategori Yang Sesuai"> <select class="form-control" id="kategori" name="kategori" data-msg="Pilih Kategori Yang Sesuai">
<option value="">Pilih Kategori</option> <option value="">Pilih Kategori</option>
@foreach($kategori as $k) @foreach($kategori as $k)
...@@ -136,6 +170,9 @@ ...@@ -136,6 +170,9 @@
</div> </div>
</div> </div>
</div> </div>
@php
$no++;
@endphp
<!-- / edit registrasi modal --> <!-- / edit registrasi modal -->
@endforeach @endforeach
</tbody> </tbody>
......
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