Commit c0b63a66 by Triyah Fatmawati

Merge branch 'master' of http://git.unesa.ac.id/aisah/sipeka

parents 679f4249 4f01aa39
......@@ -8,6 +8,7 @@
use App\Models\Admin\Pengajuan;
use Exception;
use Storage;
use Session;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
......@@ -16,8 +17,34 @@
class TransaksiController extends Controller
{
public function index() {
$pengusul = DB::table('bantuan_pengusul')->get();
public function index(Request $request) {
Session::put('status', $request->status);
if(empty(Session::get('status'))) {
$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();
$data = [
......@@ -32,7 +59,7 @@ public function store(Request $request){
$rule = [
'kategori' => 'required',
'file_ec' => 'required',
'file_ec' => 'required|mimes:pdf|max:3072',
'nosurat' => 'required'
];
......@@ -40,22 +67,27 @@ public function store(Request $request){
DB::beginTransaction();
// if($request->hasFile('file_ec')){
// $file = $request->file('file_ec');
// $filename = $file->getClientOriginalName();
try{
// Storage::disk('uploads')->put('sipeka/'.$filename, file_get_contents($file->getRealPath()));
// }
if($request->hasFile('file_ec')){
$file = $request->file('file_ec');
$filename = $file->getClientOriginalName();
try{
$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);
}
$transaksi = [
'id_pengajuan' => $request->idpengajuan,
'judul' => $request->judul,
'pengusul' => $request->pengusul,
'peneliti' => $request->peneliti,
'klasifikasi' => $request->klasifikasi,
'tahun' => $request->tahun,
'id_kategori' => $request->kategori,
// 'file_ec' => $filename,
'file_ec' => $filename,
'no_sk' => $request->nosurat,
];
......@@ -67,16 +99,25 @@ public function store(Request $request){
foreach($reviewer as $r){
$isdm = DB::connection('isdm')->table('v_detil_pegawai')->where('noktp',$r->nik)->select('namalengkap','nip')->first();
if(!empty($isdm)){
$saku = [
'id_pengajuan' => $hasil->id,
'nik' => $r->nik,
'nama' => $isdm->namalengkap,
'nip' => $isdm->nip
];
} 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();
......
......@@ -4,18 +4,18 @@
class ValidationRule{
const WARNING = [
'required' => 'can not be empty',
'numeric' => 'must be a number',
'string' => 'must be a string',
'email' => 'tidak valid',
'mimes' => 'tipe file tidak sesuai',
'unique' => 'must be unique',
'required' => 'tidak boleh kosong',
'unique' => 'sudah digunakan',
'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',
'regex' => 'harus kombinasi huruf kapital, huruf kecil, angka, dan karakter'
'required' => 'must be filled',
'numeric' => 'must be numeric',
'regex' => 'must be a combination of uppercase letters, lowercase letters, numbers and characters',
'max' => 'must be maximum',
'min' => 'must be minimum',
'email' => 'is invalid',
'mimes' => 'file type must pdf',
'unique' => 'must be unique'
];
public static function getErrorMessage($validationRules) {
......
......@@ -19,7 +19,7 @@ class Pengajuan extends Model
'id',
'id_pengajuan',
'judul',
'pengusul',
'peneliti',
'klasifikasi',
'tahun',
'id_kategori',
......
......@@ -29,9 +29,9 @@
<table id="zero-config" class="table table-hover" style="width:100%">
<thead>
<tr>
<th>No. Pengajuan</th>
<th>Id. Pengajuan</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">Tahun</th>
<th style="text-align: left">Klasifikasi</th>
......@@ -47,7 +47,8 @@
<tr>
<td>{{ $pengajuan->id_pengajuan }}</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->tahun }}</td>
<td style="text-align: left">{{ $pengajuan->klasifikasi }}</td>
......
......@@ -22,6 +22,37 @@
</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>
......@@ -29,9 +60,12 @@
<table id="zero-config" class="table table-hover" style="width:100%">
<thead>
<tr>
@php
$no = 1;
@endphp
<th>No.</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">Reviewer</th>
<th style="text-align: left">Klasifikasi</th>
......@@ -41,9 +75,9 @@
<tbody>
@foreach($pengusul as $item)
<tr>
<td>{{ $item->id_pengajuan }}</td>
<td>{{ $no }}</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>
@php
$penelaah = DB::table('bantuan_penelaah')->where('id_pengajuan', $item->id_pengajuan)->get();
......@@ -79,7 +113,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<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">
<input type="hidden" name="idpengajuan" value="{{ $item->id_pengajuan }}">
<div class="col-md-12">
......@@ -87,8 +121,8 @@
<input type="textarea" class="form-control" id="judul" name="judul" value="{{ $item->judul }}" readonly />
</div>
<div class="col-md-12">
<label class="form-label" for="pengusul">Pengusul</label>
<input type="text" class="form-control" id="pengusul" name="pengusul" value="{{ $item->pengusul }}" readonly />
<label class="form-label" for="peneliti">Peneliti</label>
<input type="text" class="form-control" id="peneliti" name="peneliti" value="{{ $item->peneliti_utama }}" readonly />
</div>
<div class="col-md-6">
<label class="form-label" for="tahun">Tahun</label>
......@@ -99,7 +133,7 @@
<input type="text" class="form-control" id="klasifikasi" name="klasifikasi" value="{{ $item->klasifikasi }}" readonly />
</div>
<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">
<option value="">Pilih Kategori</option>
@foreach($kategori as $k)
......@@ -136,6 +170,9 @@
</div>
</div>
</div>
@php
$no++;
@endphp
<!-- / edit registrasi modal -->
@endforeach
</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