Commit bf5d3a51 by Triyah Fatmawati

update dasboard dan preview surat eoffice

parent 48464d45
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Admin\MsKategori;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class DashboardController extends Controller
{
public function index(){
$kategori = MsKategori::query()->get();
foreach ($kategori as $kat) {
$pengajuan = DB::table('tr_pengajuan')
->select(DB::raw('count(*) as total'))
->where('tr_pengajuan.id_kategori', $kat->id)
->first();
$jml[$kat->kode_kategori] = $pengajuan->total;
}
$sudahKategori = DB::table('tr_pengajuan')
->whereNotNull('tr_pengajuan.id_kategori')
->count();
$belumKategori = DB::table('tr_pengajuan')
->whereNull('tr_pengajuan.id_kategori')
->count();
$data = [
'jml' => $jml,
'sudahKategori' => $sudahKategori,
'belumKategori' => $belumKategori
];
return view('dashboard', $data);
}
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Admin\Pengajuan; use App\Models\Admin\Pengajuan;
use Exception; use Exception;
use GuzzleHttp\Client;
use Storage; use Storage;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
...@@ -16,12 +17,61 @@ class SakuController extends Controller ...@@ -16,12 +17,61 @@ class SakuController extends Controller
{ {
public function index() { public function index() {
$penelaah = DB::table('tr_penelaah')->get(); $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')
->get();
if($penelaah){
foreach ($penelaah as $key => $pen) {
$nosurat = explode('/', $pen->no_sk);
$noagenda = $nosurat[0];
$tahun = $nosurat[3];
$arrPenelaah[$key] = [
'id' => $pen->id,
'id_pengajuan' => $pen->id_pengajuan,
'nik' => $pen->nik,
'nama' => $pen->nama,
'nip' => $pen->nip,
'id_pengajuan_epk' => $pen->id_pengajuan_epk,
'judul' => $pen->judul,
'peneliti' => $pen->peneliti,
'nama_kategori' => $pen->nama_kategori,
'klasifikasi' => $pen->klasifikasi,
'file_ec' => $pen->file_ec,
'tahun' => $pen->tahun,
'nosurat' => $noagenda,
'tahunsk' => $tahun,
'namafile' => $this->getFileName($tahun, $noagenda)
];
}
}
$data = [ $data = [
'penelaah' => $penelaah 'penelaah' => $arrPenelaah,
]; ];
return view('saku.index', $data); return view('saku.index', $data);
} }
public function getFileName($tahun, $nosurat){
$client = new Client();
$response = $client->request('GET', 'https://e-office.unesa.ac.id/api/show-surat-keluar/'.$tahun.'/'.$nosurat);
$data = json_decode($response->getBody(), true);
if (is_null($data)) {
$namafile = '';
}
if (empty($data)) {
$namafile = '';
}
else{
$namafile = $data['namafile'];
}
return $namafile;
}
} }
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</div> </div>
</div> </div>
<div class="my-auto"> <div class="my-auto">
<h4 class="fw-bolder mb-0">4</h4> <h4 class="fw-bolder mb-0">{{$jml['A']}}</h4>
<p class="card-text font-small-3 mb-0">Mhs S1/D4</p> <p class="card-text font-small-3 mb-0">Mhs S1/D4</p>
</div> </div>
</div> </div>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</div> </div>
</div> </div>
<div class="my-auto"> <div class="my-auto">
<h4 class="fw-bolder mb-0">1</h4> <h4 class="fw-bolder mb-0">{{$jml['B']}}</h4>
<p class="card-text font-small-3 mb-0">Mhs S2/S3</p> <p class="card-text font-small-3 mb-0">Mhs S2/S3</p>
</div> </div>
</div> </div>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</div> </div>
</div> </div>
<div class="my-auto"> <div class="my-auto">
<h4 class="fw-bolder mb-0">2</h4> <h4 class="fw-bolder mb-0">{{$jml['C']}}</h4>
<p class="card-text font-small-3 mb-0">Dosen</p> <p class="card-text font-small-3 mb-0">Dosen</p>
</div> </div>
</div> </div>
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</div> </div>
</div> </div>
<div class="my-auto"> <div class="my-auto">
<h4 class="fw-bolder mb-0">3</h4> <h4 class="fw-bolder mb-0">{{$jml['D']}}</h4>
<p class="card-text font-small-3 mb-0">Industri</p> <p class="card-text font-small-3 mb-0">Industri</p>
</div> </div>
</div> </div>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
</div> </div>
</div> </div>
<div class="my-auto"> <div class="my-auto">
<h4 class="fw-bolder mb-0">20</h4> <h4 class="fw-bolder mb-0">{{$sudahKategori}}</h4>
<p class="card-text font-small-3 mb-0">Sudah dikategorikan</p> <p class="card-text font-small-3 mb-0">Sudah dikategorikan</p>
</div> </div>
</div> </div>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
</div> </div>
</div> </div>
<div class="my-auto"> <div class="my-auto">
<h4 class="fw-bolder mb-0">10</h4> <h4 class="fw-bolder mb-0">{{$belumKategori}}</h4>
<p class="card-text font-small-3 mb-0">Belum dikategorikan</p> <p class="card-text font-small-3 mb-0">Belum dikategorikan</p>
</div> </div>
</div> </div>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<ul class="nav navbar-nav align-items-center ms-auto"> <ul class="nav navbar-nav align-items-center ms-auto">
<li class="nav-item dropdown dropdown-user"><a class="nav-link dropdown-toggle dropdown-user-link" id="dropdown-user" href="#" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <li class="nav-item dropdown dropdown-user"><a class="nav-link dropdown-toggle dropdown-user-link" id="dropdown-user" href="#" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<div class="user-nav d-sm-flex d-none"><span class="user-name fw-bolder">KEPK UNESA</span><span class="user-status">Admin</span></div><span class="avatar"><img class="round" src="{{ url('theme/images/portrait/small/avatar-s-unesa.jpg') }}" alt="avatar" height="40" width="40"><span class="avatar-status-online"></span></span> <div class="user-nav d-sm-flex d-none"><span class="user-name fw-bolder">{{auth()->user()->name}}</span><span class="user-status">Admin</span></div><span class="avatar"><img class="round" src="{{ url('theme/images/portrait/small/avatar-s-unesa.jpg') }}" alt="avatar" height="40" width="40"><span class="avatar-status-online"></span></span>
</a> </a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdown-user"><div class="dropdown-divider"></div> <div class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdown-user"><div class="dropdown-divider"></div>
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
<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>Id. Pengajuan</th> <th>No</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/NIP</th> <th style="text-align: left">Nama/NIP</th>
<th style="text-align: left">Judul</th> <th style="text-align: left">Judul</th>
...@@ -40,28 +41,35 @@ ...@@ -40,28 +41,35 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($penelaah as $item)
@php @php
$pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first(); $no = 1;
@endphp @endphp
@foreach($penelaah as $key => $item)
{{-- @php
$pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
@endphp --}}
<tr> <tr>
<td>{{ $pengajuan->id_pengajuan }}</td> <td>{{$no}}</td>
<td style="text-align: left">SURAT</td> <td>{{ $item['id_pengajuan_epk'] }}</td>
<td style="text-align: left">{{ $item->nama }}<br> <td style="text-align: left"><a href="https://e-office.unesa.ac.id/dokumen/surat_keluar/{{$item['namafile']}}" target="_blank"><img src="{{ url('assets/img/icons/misc/pdf.png') }}" alt="pdf" height="60" class="me-3" /></a></td>
<strong>{{ $item->nip }}</strong></td> <td style="text-align: left">{{ $item['nama'] }}<br>
<td style="text-align: left">{{ $pengajuan->judul }}</td> <strong>{{ $item['nip'] }}</strong></td>
<td style="text-align: left">{{ $pengajuan->tahun }}</td> <td style="text-align: left">{{ $item['judul'] }}</td>
<td style="text-align: left">{{ $pengajuan->klasifikasi }}</td> <td style="text-align: left">{{ $item['tahun'] }}</td>
<td style="text-align: left">{{ $item['klasifikasi'] }}</td>
<td style="text-align: left"> <td style="text-align: left">
@if(!empty($pengajuan->file_ec)) @if(!empty($item['file_ec']))
<strong><a href="https://sipeka.unesa.ac.id/sipeka/file/{!!$pengajuan->file_ec!!}" target="_blank" class="btn btn-success btn-md">Lihat</a></strong> <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 @endif
</td> </td>
@php {{-- @php
$kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first(); $kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp @endphp --}}
<td style="text-align: left">{{ $kategori->nama_kategori }}</td> <td style="text-align: left">{{ $item['nama_kategori'] }}</td>
</tr> </tr>
@php
$no++;
@endphp
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
......
<?php <?php
use App\Http\Controllers\Admin\Auth\LoginController; use App\Http\Controllers\Admin\Auth\LoginController;
use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\KategoriController; use App\Http\Controllers\Admin\KategoriController;
use App\Http\Controllers\Admin\TransaksiController; use App\Http\Controllers\Admin\TransaksiController;
use App\Http\Controllers\Admin\SakuController; use App\Http\Controllers\Admin\SakuController;
...@@ -25,12 +26,11 @@ ...@@ -25,12 +26,11 @@
// Route::get('/home', [TransaksiController::class, 'index'])->name('admin.index-transaksi'); // Route::get('/home', [TransaksiController::class, 'index'])->name('admin.index-transaksi');
Route::middleware(['auth','prevent-back-history'])->group(function(){ Route::middleware(['auth','prevent-back-history'])->group(function(){
Route::get('/home', function () { Route::get('/home', [DashboardController::class, 'index'])->name('admin.home');
return view('dashboard');
});
Route::resource('kategori', KategoriController::class); Route::resource('kategori', KategoriController::class);
Route::resource('transaksi', TransaksiController::class); Route::resource('transaksi', TransaksiController::class);
Route::resource('saku', SakuController::class); Route::resource('saku', SakuController::class);
Route::get('file/{tahun}/{nosurat}', [SakuController::class, 'getFileName'])->name('admin.filename');
Route::resource('user', UserController::class); Route::resource('user', UserController::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