Commit b702422a by Siti Aisah

tarik saku

parent 685c324f
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Support\ValidationRule;
use App\Http\Controllers\Controller;
use App\Models\Admin\Pengajuan;
use Exception;
use Storage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redirect;
class SakuController extends Controller
{
public function index() {
$pengusul = DB::table('bantuan_pengusul')->get();
$kategori = DB::table('ms_kategori')->orderBy('kode_kategori','asc')->get();
$data = [
'pengusul' => $pengusul,
'kategori' => $kategori
];
return view('transaksi.index', $data);
}
}
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Admin;
use App\Http\Support\ValidationRule; use App\Http\Support\ValidationRule;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Admin\Penelaah;
use App\Models\Admin\Pengajuan; use App\Models\Admin\Pengajuan;
use Exception; use Exception;
use Storage; use Storage;
...@@ -39,12 +40,12 @@ public function store(Request $request){ ...@@ -39,12 +40,12 @@ public function store(Request $request){
DB::beginTransaction(); DB::beginTransaction();
if($request->hasFile('file_ec')){ // if($request->hasFile('file_ec')){
$file = $request->file('file_ec'); // $file = $request->file('file_ec');
$filename = $file->getClientOriginalName(); // $filename = $file->getClientOriginalName();
Storage::disk('uploads')->put('sipeka/'.$filename, file_get_contents($file->getRealPath())); // Storage::disk('uploads')->put('sipeka/'.$filename, file_get_contents($file->getRealPath()));
} // }
try{ try{
$transaksi = [ $transaksi = [
...@@ -54,13 +55,29 @@ public function store(Request $request){ ...@@ -54,13 +55,29 @@ public function store(Request $request){
'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,
]; ];
Pengajuan::query()->create($transaksi); Pengajuan::query()->create($transaksi);
$hasil = DB::table('tr_pengajuan')->where('id_pengajuan',$request->idpengajuan)->get();
$reviewer = DB::table('bantuan_penelaah')->where('id_pengajuan',$request->idpengajuan)->get();
foreach($reviewer as $r){
$isdm = DB::connection('isdm')->table('v_detil_pegawai')->where('noktp',$r->nik)->select('namalengkap','nip')->first();
$saku = [
'id_pengajuan' => $hasil->id,
'nik' => $r->nik,
'nama' => $isdm->namalengkap,
'nip' => $isdm->nip
];
Penelaah::query()->create($saku);
}
DB::commit(); DB::commit();
return Redirect::route('transaksi.index') return Redirect::route('transaksi.index')
......
...@@ -15,5 +15,11 @@ class Penelaah extends Model ...@@ -15,5 +15,11 @@ class Penelaah extends Model
protected $table = 'tr_penelaah'; protected $table = 'tr_penelaah';
protected $keyType = 'string'; protected $keyType = 'string';
protected $guarded = []; protected $fillable = [
'id',
'id_pengajuan',
'nik',
'nama',
'nip'
];
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<ul class="dropdown-menu" data-bs-popper="none"> <ul class="dropdown-menu" data-bs-popper="none">
<li data-menu="" class="{{ (request()->getRequestUri() == "/transaksi") ? 'active' : '' }}"><a href="{{ route('transaksi.index') }}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather="check-square"></i><span data-i18n="Email">Update Kategori</span></a> <li data-menu="" class="{{ (request()->getRequestUri() == "/transaksi") ? 'active' : '' }}"><a href="{{ route('transaksi.index') }}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather="check-square"></i><span data-i18n="Email">Update Kategori</span></a>
</li> </li>
<li data-menu="" class="{{ (request()->is('pasien/antrian')) ? 'active' : '' }}"><a href="#" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Todo" ><i data-feather='log-in'></i><span data-i18n="Todo">Tarik Data SAKU</span></a> <li data-menu="" class="{{ (request()->getRequestUri() == "/saku") ? 'active' : '' }}"><a href="{{ route('saku.index') }}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Todo" ><i data-feather='log-in'></i><span data-i18n="Todo">Tarik Data SAKU</span></a>
</li> </li>
</ul> </ul>
</li> </li>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<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>
<th style="text-align: left">Update Kategori</th> <th style="text-align: left">Kategori</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -54,9 +54,19 @@ ...@@ -54,9 +54,19 @@
@endforeach @endforeach
</td> </td>
<td style="text-align: left">{{ $item->klasifikasi }}</td> <td style="text-align: left">{{ $item->klasifikasi }}</td>
@php
$pengajuan = DB::table('tr_pengajuan')->where('id_pengajuan',$item->id_pengajuan)->first();
@endphp
@if(empty($pengajuan))
<td> <td>
<button type="button" class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#updateKategoriModal{{ $item->id_pengajuan }}"><i data-feather='edit'></i></button> <button type="button" class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#updateKategoriModal{{ $item->id_pengajuan }}"><i data-feather='edit'></i></button>
</td> </td>
@else
@php
$kat = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp
<td style="text-align: left">{{ $kat->nama_kategori }}</td>
@endif
</tr> </tr>
<!-- edit registrasi modal --> <!-- edit registrasi modal -->
......
<?php <?php
use App\Http\Controllers\Admin\KategoriController; use App\Http\Controllers\Admin\KategoriController;
use App\Http\Controllers\TransaksiController; use App\Http\Controllers\Admin\TransaksiController;
use App\Http\Controllers\Admin\SakuController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
/* /*
...@@ -24,5 +25,6 @@ ...@@ -24,5 +25,6 @@
// Admin // Admin
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);
// End of Admin // End of Admin
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