pintu2/app/Http/Controllers/MonitoringController.php

64 lines
2.2 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\Models\PengajuanDpuDpa;
2024-03-15 18:36:20 +07:00
use App\Models\PengajuanSempro;
use Illuminate\Http\Request;
class MonitoringController extends Controller
{
2024-03-15 18:36:20 +07:00
public function index(){
return view('monitoring.index',['title' => 'Cari Pengajuan Anda Menggunakan CASEID yang Dikirim Lewat Email']);
}
public function search(Request $request){
return redirect()->route('monitoring.caseid',['caseid'=>$request->caseid]);
}
public function caseid($caseid){
2024-03-15 18:36:20 +07:00
$cek_caseid = substr($caseid, 0, 2);
if($cek_caseid=="LS"){
$data = PengajuanDpuDpa::where('caseid', $caseid)
->select(
'pengajuan_dpu_dpas.*',
'mahasiswas.nim',
'mahasiswas.nama',
'mahasiswas.judul_seminar_proposal',
'dosen_dpu.nama_gelar as dosen_dpu_nama_gelar',
'dosen_dpa.nama_gelar as dosen_dpa_nama_gelar',
)
->join('mahasiswas','mahasiswas_id','=','mahasiswas.id')
->join('users as dosen_dpu','mahasiswas.dosen_dpu_id','=','dosen_dpu.id')
->join('users as dosen_dpa','mahasiswas.dosen_dpa_id','=','dosen_dpa.id')
->first();
if($data==null){
return redirect()->route('monitoring.index')->with('error','CaseID Tidak Ditemukan');
}
return view('monitoring.dpu_dpa',['title' => 'Monitoring Pengajuan DPU/DPA - '.$caseid,'data' => $data]);
}
elseif($cek_caseid=="LP"){
$data = PengajuanSempro::where('caseid',$caseid)
->select(
'pengajuan_sempros.*',
'mahasiswas.nim',
'mahasiswas.nama',
'mahasiswas.judul_seminar_proposal',
'dosen_dpu.nama_gelar as dosen_dpu_nama_gelar',
)
->join('mahasiswas','mahasiswas_id','=','mahasiswas.id')
->join('users as dosen_dpu','mahasiswas.dosen_dpu_id','=','dosen_dpu.id')
->first();
if($data==null){
return redirect()->route('monitoring.index')->with('error','CaseID Tidak Ditemukan');
}
return view('monitoring.sempro',['title' => 'Monitoring Pengajuan Seminar Proposal - '.$caseid,'data' => $data]);
}
else{
return redirect()->route('monitoring.index')->with('error','CaseID Tidak Valid');
}
}
}