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 @@
use App\Http\Controllers\Controller;
use App\Models\Admin\Pengajuan;
use Exception;
use GuzzleHttp\Client;
use Storage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
......@@ -16,12 +17,61 @@ class SakuController extends Controller
{
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 = [
'penelaah' => $penelaah
'penelaah' => $arrPenelaah,
];
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;
}
}
......@@ -39,60 +39,60 @@
<h4 class="card-title">Pengusul</h4>
</div>
<div class="card-body statistics-body">
<div class="row">
<div class="col-xl-3 col-sm-6 col-12 mb-2 mb-xl-0">
<div class="d-flex flex-row">
<div class="avatar bg-light-primary me-2">
<div class="avatar-content">
<i data-feather='users' class="avatar-icon"></i>
<div class="row">
<div class="col-xl-3 col-sm-6 col-12 mb-2 mb-xl-0">
<div class="d-flex flex-row">
<div class="avatar bg-light-primary me-2">
<div class="avatar-content">
<i data-feather='users' class="avatar-icon"></i>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">{{$jml['A']}}</h4>
<p class="card-text font-small-3 mb-0">Mhs S1/D4</p>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">4</h4>
<p class="card-text font-small-3 mb-0">Mhs S1/D4</p>
</div>
</div>
</div>
<div class="col-xl-3 col-sm-6 col-12 mb-2 mb-xl-0">
<div class="d-flex flex-row">
<div class="avatar bg-light-info me-2">
<div class="avatar-content">
<i data-feather="users" class="avatar-icon"></i>
<div class="col-xl-3 col-sm-6 col-12 mb-2 mb-xl-0">
<div class="d-flex flex-row">
<div class="avatar bg-light-info me-2">
<div class="avatar-content">
<i data-feather="users" class="avatar-icon"></i>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">{{$jml['B']}}</h4>
<p class="card-text font-small-3 mb-0">Mhs S2/S3</p>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">1</h4>
<p class="card-text font-small-3 mb-0">Mhs S2/S3</p>
</div>
</div>
</div>
<div class="col-xl-3 col-sm-6 col-12 mb-2 mb-sm-0">
<div class="d-flex flex-row">
<div class="avatar bg-light-danger me-2">
<div class="avatar-content">
<i data-feather="users" class="avatar-icon"></i>
<div class="col-xl-3 col-sm-6 col-12 mb-2 mb-sm-0">
<div class="d-flex flex-row">
<div class="avatar bg-light-danger me-2">
<div class="avatar-content">
<i data-feather="users" class="avatar-icon"></i>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">{{$jml['C']}}</h4>
<p class="card-text font-small-3 mb-0">Dosen</p>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">2</h4>
<p class="card-text font-small-3 mb-0">Dosen</p>
</div>
</div>
</div>
<div class="col-xl-3 col-sm-6 col-12">
<div class="d-flex flex-row">
<div class="avatar bg-light-success me-2">
<div class="avatar-content">
<i data-feather="users" class="avatar-icon"></i>
<div class="col-xl-3 col-sm-6 col-12">
<div class="d-flex flex-row">
<div class="avatar bg-light-success me-2">
<div class="avatar-content">
<i data-feather="users" class="avatar-icon"></i>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">{{$jml['D']}}</h4>
<p class="card-text font-small-3 mb-0">Industri</p>
</div>
</div>
<div class="my-auto">
<h4 class="fw-bolder mb-0">3</h4>
<p class="card-text font-small-3 mb-0">Industri</p>
</div>
</div>
</div>
</div>
</div>
<div class="card-header">
<h4 class="card-title">Kategori</h4>
......@@ -107,7 +107,7 @@
</div>
</div>
<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>
</div>
</div>
......@@ -120,7 +120,7 @@
</div>
</div>
<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>
</div>
</div>
......
......@@ -23,7 +23,7 @@
</div>
<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">
<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>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdown-user"><div class="dropdown-divider"></div>
......
......@@ -29,39 +29,47 @@
<table id="zero-config" class="table table-hover" style="width:100%">
<thead>
<tr>
<th>Id. Pengajuan</th>
<th style="text-align: left">File SK</th>
<th>No</th>
<th>ID Pengajuan</th>
<th style="text-align: left">File SK</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>
<th style="text-align: left">File EC</th>
<th style="text-align: left">Kategori</th>
<th style="text-align: left">Kategori</th>
</tr>
</thead>
<tbody>
@foreach($penelaah as $item)
@php
$pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
$no = 1;
@endphp
@foreach($penelaah as $key => $item)
{{-- @php
$pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
@endphp --}}
<tr>
<td>{{ $pengajuan->id_pengajuan }}</td>
<td style="text-align: left">SURAT</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>
<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/{{$item['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($pengajuan->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>
@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
{{-- @php
$kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp
<td style="text-align: left">{{ $kategori->nama_kategori }}</td>
@endphp --}}
<td style="text-align: left">{{ $item['nama_kategori'] }}</td>
</tr>
@php
$no++;
@endphp
@endforeach
</tbody>
</table>
......
<?php
use App\Http\Controllers\Admin\Auth\LoginController;
use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\KategoriController;
use App\Http\Controllers\Admin\TransaksiController;
use App\Http\Controllers\Admin\SakuController;
......@@ -25,12 +26,11 @@
// Route::get('/home', [TransaksiController::class, 'index'])->name('admin.index-transaksi');
Route::middleware(['auth','prevent-back-history'])->group(function(){
Route::get('/home', function () {
return view('dashboard');
});
Route::get('/home', [DashboardController::class, 'index'])->name('admin.home');
Route::resource('kategori', KategoriController::class);
Route::resource('transaksi', TransaksiController::class);
Route::resource('saku', SakuController::class);
Route::get('file/{tahun}/{nosurat}', [SakuController::class, 'getFileName'])->name('admin.filename');
Route::resource('user', UserController::class);
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