Commit 0b37fad0 by Siti Aisah

add master periode, filter periode, fix dashboard

parent ef9c054f
...@@ -19,22 +19,20 @@ public function index(Request $request) { ...@@ -19,22 +19,20 @@ public function index(Request $request) {
if(empty(Session::get('periode'))) { if(empty(Session::get('periode'))) {
$rs = DB::table('v_saku_new') $periode = DB::table('ms_periode')->where('is_aktif', 1)->first();
->select('nama', 'nip', 'unit', DB::raw('COUNT(id_pengajuan) as jumlah')) Session::put('periode', $periode->periode);
->groupBy('nama', 'nip', 'unit')
->get();
} else { } else {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first(); $periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
$rs = DB::table('v_saku_new') }
$rs = DB::table('v_saku_new')
->select('nama', 'nip', 'unit', DB::raw('COUNT(id_pengajuan) as jumlah')) ->select('nama', 'nip', 'unit', DB::raw('COUNT(id_pengajuan) as jumlah'))
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir]) ->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->groupBy('nama', 'nip', 'unit') ->groupBy('nama', 'nip', 'unit')
->get(); ->get();
}
$data = [ $data = [
'rs' => $rs, 'rs' => $rs,
'periode' => $filter_periode 'periode' => $filter_periode
...@@ -47,26 +45,22 @@ public function download(Request $request) { ...@@ -47,26 +45,22 @@ public function download(Request $request) {
if(empty(Session::get('periode'))) { if(empty(Session::get('periode'))) {
$data['rs'] = DB::table('v_saku_new') $periode = DB::table('ms_periode')->where('is_aktif', 1)->first();
->select('nama', 'nip', 'unit', DB::raw('COUNT(id_pengajuan) as jumlah')) Session::put('periode', $periode->periode);
->groupBy('nama', 'nip', 'unit')
->get();
$data['nama_file'] = 'Laporan Reviewer Sipeka Semua Periode';
} else { } else {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first(); $periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
$data['rs'] = DB::table('v_saku_new') }
$data['nama_file'] = 'Laporan Reviewer Sipeka Periode '. $periode->periode;
$data['rs'] = DB::table('v_saku_new')
->select('nama', 'nip', 'unit', DB::raw('COUNT(id_pengajuan) as jumlah')) ->select('nama', 'nip', 'unit', DB::raw('COUNT(id_pengajuan) as jumlah'))
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir]) ->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->groupBy('nama', 'nip', 'unit') ->groupBy('nama', 'nip', 'unit')
->get(); ->get();
$data['nama_file'] = 'Laporan Reviewer Sipeka Periode '. $periode->periode;
}
return view('laporan.excel', $data); return view('laporan.excel', $data);
} }
} }
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Support\ValidationRule;
use App\Models\Admin\Periode;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redirect;
class PeriodeController extends Controller
{
public function index(){
$periode = Periode::query()->get();
$data = [
'periode' => $periode
];
return view('Admin.Periode.index', $data);
}
public function store(Request $request){
DB::beginTransaction();
try{
$rule = [
'periode' => 'required',
'tanggal_awal' => 'required|date',
'tanggal_akhir' => 'required|date',
'is_aktif' => 'required'
];
$request->validate($rule, ValidationRule::getErrorMessage($rule));
$periode = [
'periode' => $request->periode,
'tanggal_awal' => $request->tanggal_awal,
'tanggal_akhir' => $request->tanggal_akhir,
'is_aktif' => $request->is_aktif,
];
Periode::query()->create($periode);
DB::commit();
return Redirect::route('periode.index')
->with('success', 'Periode berhasil ditambahkan');
}
catch(Exception $e){
Log::error($e);
DB::rollBack();
return Redirect::route('periode.index')
->with('error', 'Periode gagal ditambahkan');
}
}
public function update(Request $request, $id){
DB::beginTransaction();
try{
$id = decrypt($id);
$rule = [
'periode' => 'required',
'tanggal_awal' => 'required|date',
'tanggal_akhir' => 'required|date',
'is_aktif' => 'required'
];
$request->validate($rule, ValidationRule::getErrorMessage($rule));
$periode = [
'periode' => $request->periode,
'tanggal_awal' => $request->tanggal_awal,
'tanggal_akhir' => $request->tanggal_akhir,
'is_aktif' => $request->is_aktif,
];
Periode::where('periode', $id)->update($periode);
DB::commit();
return Redirect::route('periode.index')
->with('success', 'Periode berhasil diupdate');
}
catch(Exception $e){
Log::error($e);
DB::rollBack();
return Redirect::route('periode.index')
->with('error', 'Periode gagal diupdate');
}
}
// public function destroy($id) {
// $id = decrypt($id);
// DB::beginTransaction();
// try{
// User::where('id', $id)->delete();
// DB::commit();
// return Redirect::route('user.index')
// ->with('success', 'User berhasil dihapus');
// }
// catch(Exception $e){
// Log::error($e);
// DB::rollBack();
// return Redirect::route('user.index')
// ->with('error', 'User gagal dihapus');
// }
// }
}
...@@ -9,23 +9,37 @@ ...@@ -9,23 +9,37 @@
use Storage; use Storage;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Session;
class SakuController extends Controller class SakuController extends Controller
{ {
public function index() { public function index(Request $request) {
// $penelaah = DB::table('tr_penelaah')->orderBy('id_pengajuan')->get(); // $penelaah = DB::table('tr_penelaah')->orderBy('id_pengajuan')->get();
$penelaah = DB::table('tr_penelaah') $filter_periode = DB::table('ms_periode')->orderBy('periode','asc')->get();
->select('tr_penelaah.*', 'tr_pengajuan.id_pengajuan as id_pengajuan_epk', 'tr_pengajuan.no_sk', 'tr_pengajuan.judul', 'tr_pengajuan.peneliti', 'tr_pengajuan.tahun', 'tr_pengajuan.klasifikasi', 'tr_pengajuan.file_ec', 'ms_kategori.nama_kategori')
->join('tr_pengajuan', 'tr_pengajuan.id', 'tr_penelaah.id_pengajuan') Session::put('periode', $request->periode);
->join('ms_kategori', 'ms_kategori.id', 'tr_pengajuan.id_kategori')
->orderBy('id_pengajuan')
->get();
if(empty(Session::get('periode'))) {
$periode = DB::table('ms_periode')->where('is_aktif', 1)->first();
Session::put('periode', $periode->periode);
} else {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$penelaah = DB::table('tr_penelaah')
->select('tr_penelaah.*', 'tr_pengajuan.id_pengajuan as id_pengajuan_epk', 'tr_pengajuan.no_sk', 'tr_pengajuan.judul', 'tr_pengajuan.peneliti', 'tr_pengajuan.tahun', 'tr_pengajuan.klasifikasi', 'tr_pengajuan.file_ec', 'ms_kategori.nama_kategori')
->join('tr_pengajuan', 'tr_pengajuan.id', 'tr_penelaah.id_pengajuan')
->join('ms_kategori', 'ms_kategori.id', 'tr_pengajuan.id_kategori')
->join('bantuan_pengusul', 'bantuan_pengusul.id_pengajuan', 'tr_pengajuan.id_pengajuan')
->whereBetween('bantuan_pengusul.tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->orderBy('id_pengajuan')
->get();
$data = [ $data = [
'penelaah' => $penelaah, 'penelaah' => $penelaah,
'periode' => $filter_periode
]; ];
return view('saku.index', $data); return view('saku.index', $data);
......
...@@ -19,11 +19,23 @@ class TransaksiController extends Controller ...@@ -19,11 +19,23 @@ class TransaksiController extends Controller
public function index(Request $request) { public function index(Request $request) {
$filter_periode = DB::table('ms_periode')->orderBy('periode','asc')->get();
Session::put('status', $request->status); Session::put('status', $request->status);
Session::put('periode', $request->periode);
if(empty(Session::get('status'))) { if(empty(Session::get('status'))) {
if(empty(Session::get('periode'))){
$periode = DB::table('ms_periode')->where('is_aktif', 1)->first();
Session::put('periode', $periode->periode);
} else {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$pengusul = DB::table('bantuan_pengusul')->get(); $pengusul = DB::table('bantuan_pengusul')
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->get();
} else { } else {
...@@ -35,11 +47,30 @@ public function index(Request $request) { ...@@ -35,11 +47,30 @@ public function index(Request $request) {
if(Session::get('status') == '1'){ if(Session::get('status') == '1'){
$pengusul = DB::table('bantuan_pengusul')->whereIn('id_pengajuan',$list)->get(); if(empty(Session::get('periode'))){
$periode = DB::table('ms_periode')->where('is_aktif', 1)->first();
Session::put('periode', $periode->periode);
} else {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$pengusul = DB::table('bantuan_pengusul')
->whereIn('id_pengajuan',$list)
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->get();
}elseif(Session::get('status') == '2'){ }elseif(Session::get('status') == '2'){
if(empty(Session::get('periode'))){
$periode = DB::table('ms_periode')->where('is_aktif', 1)->first();
Session::put('periode', $periode->periode);
} else {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$pengusul = DB::table('bantuan_pengusul')->whereNotIn('id_pengajuan',$list)->get(); $pengusul = DB::table('bantuan_pengusul')
->whereNotIn('id_pengajuan',$list)
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->get();
} }
...@@ -49,7 +80,8 @@ public function index(Request $request) { ...@@ -49,7 +80,8 @@ public function index(Request $request) {
$data = [ $data = [
'pengusul' => $pengusul, 'pengusul' => $pengusul,
'kategori' => $kategori 'kategori' => $kategori,
'periode' => $filter_periode
]; ];
return view('transaksi.index', $data); return view('transaksi.index', $data);
......
...@@ -8,13 +8,12 @@ class ValidationRule{ ...@@ -8,13 +8,12 @@ class ValidationRule{
'numeric' => 'must be a number', 'numeric' => 'must be a number',
'string' => 'must be a string', 'string' => 'must be a string',
'unique' => 'must be unique', 'unique' => 'must be unique',
'required' => 'must be filled',
'numeric' => 'must be numeric',
'regex' => 'must be a combination of uppercase letters, lowercase letters, numbers and characters', 'regex' => 'must be a combination of uppercase letters, lowercase letters, numbers and characters',
'max' => 'must be maximum', 'max' => 'must be maximum',
'min' => 'must be minimum', 'min' => 'must be minimum',
'email' => 'is invalid', 'email' => 'is invalid',
'mimes' => 'file type must pdf', 'mimes' => 'file type must pdf',
'date' => 'must be a valid date', // Menambahkan pesan untuk date
'unique' => 'must be unique' 'unique' => 'must be unique'
]; ];
......
<?php
namespace App\Models\Admin;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Periode extends Model
{
use HasFactory;
public $incrementing = false;
protected $table = 'ms_periode';
protected $keyType = 'string';
protected $fillable = [
'periode',
'tanggal_awal',
'tanggal_akhir',
'is_aktif',
];
}
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<div class="col-md-3"> <div class="col-md-3">
<label>Periode</label> <label>Periode</label>
<select name="periode" class="form-control"> <select name="periode" class="form-control">
<option value="">Semua</option>
@foreach($periode as $p) @foreach($periode as $p)
<option value={{ $p->periode }} @if( Session::get('periode') == $p->periode) selected="selected" @endif>{{ $p->periode }}</option> <option value={{ $p->periode }} @if( Session::get('periode') == $p->periode) selected="selected" @endif>{{ $p->periode }}</option>
@endforeach @endforeach
...@@ -50,21 +49,25 @@ ...@@ -50,21 +49,25 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@php @if($rs->isNotEmpty())
$no = 1;
@endphp
@foreach($rs as $item)
<tr>
<td>{{ $no }}</td>
<td style="text-align: left">{{ $item->nama }}</td>
<td style="text-align: left">{{ $item->nip }}</td>
<td style="text-align: left">{{ $item->unit }}</td>
<td style="text-align: left">{{ $item->jumlah }}</td>
</tr>
@php @php
$no++; $no = 1;
@endphp @endphp
@endforeach @foreach($rs as $item)
<tr>
<td>{{ $no }}</td>
<td style="text-align: left">{{ $item->nama }}</td>
<td style="text-align: left">{{ $item->nip }}</td>
<td style="text-align: left">{{ $item->unit }}</td>
<td style="text-align: left">{{ $item->jumlah }}</td>
</tr>
@php
$no++;
@endphp
@endforeach
@else
<td colspan="5" style="text-align: center">Data tidak ditemukan.</td>
@endif
</tbody> </tbody>
</table> </table>
</div> </div>
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
</li> </li>
<li data-menu="" class="{{ (request()->getRequestUri() == "/user") ? 'active' : '' }}"><a href="{{route('user.index')}}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather='user'></i><span data-i18n="Email">Master User</span></a> <li data-menu="" class="{{ (request()->getRequestUri() == "/user") ? 'active' : '' }}"><a href="{{route('user.index')}}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather='user'></i><span data-i18n="Email">Master User</span></a>
</li> </li>
<li data-menu="" class="{{ (request()->getRequestUri() == "/periode") ? 'active' : '' }}"><a href="{{route('periode.index')}}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather='calendar'></i><span data-i18n="Email">Master Periode</span></a>
</li>
</ul> </ul>
</li> </li>
<li class="dropdown nav-item" data-menu="dropdown"><a class="dropdown-toggle nav-link d-flex align-items-center" href="#" data-bs-toggle="dropdown"><i data-feather='edit'></i><span data-i18n="Apps">Transaksi</span></a> <li class="dropdown nav-item" data-menu="dropdown"><a class="dropdown-toggle nav-link d-flex align-items-center" href="#" data-bs-toggle="dropdown"><i data-feather='edit'></i><span data-i18n="Apps">Transaksi</span></a>
......
...@@ -9,17 +9,25 @@ ...@@ -9,17 +9,25 @@
<div class="card-body"> <div class="card-body">
<div class="card-text"> <div class="card-text">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="panel panel-info">
{{-- @livewire('admin.masters.registrasi.add-registrasi-component') --}} <div class="panel-body">
</div> <form action="{{ route('saku.index') }}" method="GET">
<div class="col-md-4 text-right"> <div class="row">
{{-- <div class="row"> <div class="col-md-3">
<label class="col-sm-3 col-form-label"></label> <label>Periode</label>
<label class="col-sm-3 col-form-label">Cari : </label> <select name="periode" class="form-control">
<div class="col-sm-6"> @foreach($periode as $p)
<input type="text" class="form-control align-right" placeholder="Search" wire:model="keyword"> <option value={{ $p->periode }} @if( Session::get('periode') == $p->periode) selected="selected" @endif>{{ $p->periode }}</option>
</div> @endforeach
</div> --}} </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>
...@@ -41,50 +49,54 @@ ...@@ -41,50 +49,54 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@php @if($penelaah->isNotEmpty())
$no = 1; @php
$nomorsurat = $penelaah[0]->no_sk; $no = 1;
$no_surat = explode('/', $nomorsurat); $nomorsurat = $penelaah[0]->no_sk;
$noagenda = $no_surat[0]; $no_surat = explode('/', $nomorsurat);
$tahun = $no_surat[3]; $noagenda = $no_surat[0];
$nama_file = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda); $tahun = $no_surat[3];
@endphp $nama_file = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
@foreach($penelaah as $key => $item) @endphp
@php @foreach($penelaah as $key => $item)
// $pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
if($item->no_sk == $nomorsurat){
$namafile = $nama_file;
}
else{
$nosurat = explode('/', $item->no_sk);
$noagenda = $nosurat[0];
$tahun = $nosurat[3];
$namafile = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
}
@endphp
<tr>
<td>{{ $no }}</td>
{{-- <td>{{ $item->id_pengajuan_epk }}</td> --}}
<td style="text-align: left"><a href="https://e-office.unesa.ac.id/dokumen/surat_keluar/{{$namafile}}" target="_blank"><img src="{{ url('assets/img/icons/misc/pdf.png') }}" alt="pdf" height="60" class="me-3" /></a></td>
<td style="text-align: left">{{ $item->nama }}<br>
<strong>{{ $item->nip }}</strong></td>
<td style="text-align: left">{{ $item->judul }}</td>
<td style="text-align: left">{{ $item->tahun }}</td>
<td style="text-align: left">{{ $item->klasifikasi }}</td>
<td style="text-align: left">
@if(!empty($item->file_ec))
<strong><a href="https://sipeka.unesa.ac.id/sipeka/file/{!!$item->file_ec!!}" target="_blank" class="btn btn-success btn-md">Lihat</a></strong>
@endif
</td>
{{-- @php
$kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp --}}
<td style="text-align: left">{{ $item->nama_kategori }}</td>
</tr>
@php @php
$no++; // $pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
if($item->no_sk == $nomorsurat){
$namafile = $nama_file;
}
else{
$nosurat = explode('/', $item->no_sk);
$noagenda = $nosurat[0];
$tahun = $nosurat[3];
$namafile = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
}
@endphp @endphp
@endforeach <tr>
<td>{{ $no }}</td>
{{-- <td>{{ $item->id_pengajuan_epk }}</td> --}}
<td style="text-align: left"><a href="https://e-office.unesa.ac.id/dokumen/surat_keluar/{{$namafile}}" target="_blank"><img src="{{ url('assets/img/icons/misc/pdf.png') }}" alt="pdf" height="60" class="me-3" /></a></td>
<td style="text-align: left">{{ $item->nama }}<br>
<strong>{{ $item->nip }}</strong></td>
<td style="text-align: left">{{ $item->judul }}</td>
<td style="text-align: left">{{ $item->tahun }}</td>
<td style="text-align: left">{{ $item->klasifikasi }}</td>
<td style="text-align: left">
@if(!empty($item->file_ec))
<strong><a href="https://sipeka.unesa.ac.id/sipeka/file/{!!$item->file_ec!!}" target="_blank" class="btn btn-success btn-md">Lihat</a></strong>
@endif
</td>
{{-- @php
$kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp --}}
<td style="text-align: left">{{ $item->nama_kategori }}</td>
</tr>
@php
$no++;
@endphp
@endforeach
@else
<td colspan="8" style="text-align: center">Data tidak ditemukan.</td>
@endif
</tbody> </tbody>
</table> </table>
</div> </div>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use App\Http\Controllers\Admin\DashboardController; use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\KategoriController; use App\Http\Controllers\Admin\KategoriController;
use App\Http\Controllers\Admin\LaporanController; use App\Http\Controllers\Admin\LaporanController;
use App\Http\Controllers\Admin\PeriodeController;
use App\Http\Controllers\Admin\TransaksiController; use App\Http\Controllers\Admin\TransaksiController;
use App\Http\Controllers\Admin\SakuController; use App\Http\Controllers\Admin\SakuController;
use App\Http\Controllers\Admin\UserController; use App\Http\Controllers\Admin\UserController;
...@@ -34,5 +35,6 @@ ...@@ -34,5 +35,6 @@
Route::resource('laporan', LaporanController::class); Route::resource('laporan', LaporanController::class);
Route::post('/excel', [LaporanController::class, 'download'])->name('laporan.download'); Route::post('/excel', [LaporanController::class, 'download'])->name('laporan.download');
Route::resource('user', UserController::class); Route::resource('user', UserController::class);
Route::resource('periode', PeriodeController::class);
Route::get('/logout', [LoginController::class, 'logout'])->name('admin.logout'); Route::get('/logout', [LoginController::class, 'logout'])->name('admin.logout');
}); });
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