diff --git a/app/Http/Controllers/LayananPengajuanDpuDpaController.php b/app/Http/Controllers/LayananPengajuanDpuDpaController.php index 344d51b..626402e 100644 --- a/app/Http/Controllers/LayananPengajuanDpuDpaController.php +++ b/app/Http/Controllers/LayananPengajuanDpuDpaController.php @@ -4,6 +4,7 @@ use App\Jobs\layananPengajuanDpuDpaJob; +use App\Models\Bagian; use App\Models\Mahasiswa; use App\Models\PengajuanDpuDpa; use App\Models\User; @@ -12,6 +13,7 @@ use Carbon\Carbon; use Illuminate\Http\Request; + use Illuminate\Support\Facades\Storage; use SimpleSoftwareIO\QrCode\Facades\QrCode; use Spatie\Permission\Models\Role; @@ -37,7 +39,8 @@ public function index(){ //done public function tambah(){ $dosen = User::role('Dosen')->get(); - return view('layanan-dpudpa.tambah',['dosen'=>$dosen]); + $bagian = Bagian::select('id', 'nama_bagian')->get(); + return view('layanan-dpudpa.tambah',['dosen'=>$dosen, 'bagian'=>$bagian]); } //done @@ -296,7 +299,7 @@ public function submitettd($url, $caseid, Request $request){ } } -//belum +//done public function cetak($caseid){ $get_data = PengajuanDpuDpa::where('caseid',$caseid)->first(); if($get_data->ttd_kombi=='-'){ @@ -308,7 +311,7 @@ public function cetak($caseid){ 'pengajuan_dpu_dpas.*', 'mahasiswas.nim', 'mahasiswas.nama', - 'mahasiswas.bagian', + 'bagians.nama_bagian', 'mahasiswas.judul_seminar_proposal', 'dosen_dpu.nama_gelar as dosen_dpu_nama_gelar', 'dosen_dpu.nip as dosen_dpu_nip', @@ -316,7 +319,7 @@ public function cetak($caseid){ 'dosen_dpa.nip as dosen_dpa_nip', ) ->join('mahasiswas','mahasiswas_id','=','mahasiswas.id') - ->join('bagians','bagian','=','bagians.id') + ->join('bagians','mahasiswas.bagian','=','bagians.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(); diff --git a/app/Http/Controllers/LayananSeminarProposal.php b/app/Http/Controllers/LayananSeminarProposal.php index cd86297..679ec74 100644 --- a/app/Http/Controllers/LayananSeminarProposal.php +++ b/app/Http/Controllers/LayananSeminarProposal.php @@ -2,8 +2,20 @@ namespace App\Http\Controllers; +use App\Jobs\kirimNotifikasiErrorJob; +use App\Jobs\layananSeminarProposalJob; + +use App\Models\Bagian; +use App\Models\Mahasiswa; use App\Models\PengajuanSempro; +use App\Models\User; +use Barryvdh\DomPDF\Facade\Pdf; +use Carbon\Carbon; +use Exception; + use Illuminate\Http\Request; +use Illuminate\Support\Facades\Storage; +use SimpleSoftwareIO\QrCode\Facades\QrCode; class LayananSeminarProposal extends Controller { @@ -23,12 +35,335 @@ public function index(){ return view('layanan-sempro.index',['title' => 'Pengajuan Seminar Proposal | Admin Dashboard','data' => $data]); } +//done +public function tambah(){ + //ambil data dosen, dan laboratorium + $dosen = User::role('Dosen')->get(); + $bagian = Bagian::select('id','nama_bagian')->get(); + //cek apakah ada data mahasiswa dari hasil cari + $nim = session('mahasiswas_id'); + if($nim!=null){ + $data_mahasiswa = Mahasiswa::find($nim); + return view('layanan-sempro.tambah',['dosen'=>$dosen, 'bagian'=>$bagian,'data_mahasiswa'=>$data_mahasiswa]); + } + return view('layanan-sempro.tambah',['dosen'=>$dosen, 'bagian'=>$bagian]); +} +//done +public function cari(){ + return view('layanan-sempro.cari',['title'=>'Cari Data Mahasiswa Untuk Keperluan Pengajuan Seminar Proposal']); +} +//done +public function search(Request $request){ + $data = Mahasiswa::where('nim',$request->nim)->first(); + if($data==null){ + return redirect()->route('layanan-sempro.tambah')->with('error','NIM Tidak Ditemukan, Gunakan Fitur Tambah'); + } + return redirect()->route('layanan-sempro.tambah')->with('mahasiswas_id',$data->id); +} + +//done +public function store(Request $request){ + + $request->validate([ + 'nim'=>'required|numeric', + 'nama'=>'required', + 'nomor_hp'=>'required|numeric', + 'email'=>'required|email', + 'judul_seminar_proposal'=>'required', + 'bagian'=>'required|numeric', + 'dosen_dpu'=>'required|numeric', + 'dosen_dpa'=>'required|numeric', + 'dosen_penguji1'=>'required|numeric', + 'dosen_penguji2'=>'required|numeric', + 'nilai_plagiasi'=>'required|numeric', + 'bukti_hadir_sempro' => 'required|mimes:pdf|max:4096', + 'bukti_turnitin' => 'required|mimes:pdf|max:4096', + 'bukti_sister' => 'required|mimes:pdf|max:4096', + 'bukti_lembar_monitoring' => 'required|mimes:pdf|max:4096', + 'bukti_naskah_dosen_pembimbing' => 'required|mimes:pdf|max:4096', + 'bukti_naskah_dosen_penguji' => 'required|mimes:pdf|max:4096', + ],[ + 'nim.required'=>'NIP Wajib Diisi', + 'nim.numeric'=>'NIM Wajib Berisi Angka saja', + 'nomor_hp.numeric'=>'Nomor HP Wajib Menggunakan Angka, Contoh 089xxxxx', + 'email.email'=>'Format email tidak sesuai, cek lagi email anda, Contoh mahasiswa@gmail.com/ mahasiswa@mail.unej.ac.id', + 'bagian.numeric'=>'Bagian tidak valid, cek kembali Bagian yang dipilih', + 'dosen_dpu.numeric'=>'Dosen Pembimbing tidak valid, cek kembali Dosen Pembimbing Utama yang dipilih', + 'dosen_dpa.numeric'=>'Dosen Pembimbing tidak valid, cek kembali Dosen Pembimbing Anggota yang dipilih', + 'dosen_penguji1.numeric'=>'Dosen Penguji tidak valid, cek kembali Dosen Penguji Utama yang dipilih', + 'dosen_penguji2.numeric'=>'Dosen Penguji tidak valid, cek kembali Dosen Penguji Anggota yang dipilih', + 'nilai_plagiasi.numeric'=>'Masukkan Nilai Plagiasi Berupa Angka saja', + ]); + + //olah file + $bukti_hadir_sempro = $request->file('bukti_hadir_sempro'); + $bukti_turnitin = $request->file('bukti_turnitin'); + $bukti_sister = $request->file('bukti_sister'); + $bukti_lembar_monitoring = $request->file('bukti_lembar_monitoring'); + $bukti_naskah_dosen_pembimbing = $request->file('bukti_naskah_dosen_pembimbing'); + $bukti_naskah_dosen_penguji = $request->file('bukti_naskah_dosen_penguji'); + //beri nama tiap file + $bukti_hadir_sempro_name= 'LP_1'.str_replace(' ', '_',$bukti_hadir_sempro->getClientOriginalName()); + $bukti_turnitin_name = 'LP_2'.str_replace(' ', '_',$bukti_turnitin->getClientOriginalName()); + $bukti_sister_name = 'LP_3'.str_replace(' ', '_',$bukti_sister->getClientOriginalName()); + $bukti_lembar_monitoring_name = 'LP_4'.str_replace(' ', '_',$bukti_lembar_monitoring->getClientOriginalName()); + $bukti_naskah_dosen_pembimbing_name = 'LP_5'.str_replace(' ', '_',$bukti_naskah_dosen_pembimbing->getClientOriginalName()); + $bukti_naskah_dosen_penguji_name = 'LP_6'.str_replace(' ', '_',$bukti_naskah_dosen_penguji->getClientOriginalName()); + + //cek apakah data mahasiswa ada, jika ada maka dikembalikan dan dianjurkan menggunakan fitur cari + $mahasiswa = Mahasiswa::where('nim',$request->nim)->first(); + if(!is_null($mahasiswa) && $request->status!="ada"){ + return redirect()->route('layanan-sempro.tambah')->with('error','Data Anda Sudah Ada, Gunakan Fitur Cari Menggunakan NIM :'.$request->nim); + } + //kalo menggunakan fitur cari, akan menggunakan fungsi ini + elseif(!is_null($mahasiswa) && $request->status=="ada"){ + $mahasiswas_id = $mahasiswa->id; + $data_sempro['mahasiswas_id'] = $mahasiswas_id; + $data_sempro['nilai_plagiasi'] = $request->nilai_plagiasi; + $data_sempro['bukti_hadir_sempro'] = $bukti_hadir_sempro_name; + $data_sempro['bukti_turnitin'] = $bukti_turnitin_name; + $data_sempro['bukti_sister'] = $bukti_sister_name; + $data_sempro['bukti_lembar_monitoring'] = $bukti_lembar_monitoring_name; + $data_sempro['bukti_naskah_dosen_pembimbing'] = $bukti_naskah_dosen_pembimbing_name; + $data_sempro['bukti_naskah_dosen_penguji'] = $bukti_naskah_dosen_penguji_name; + PengajuanSempro::create($data_sempro); + + Storage::disk('public')->put($request->nim.'/'.$bukti_hadir_sempro_name, file_get_contents($bukti_hadir_sempro)); + Storage::disk('public')->put($request->nim.'/'.$bukti_turnitin_name, file_get_contents($bukti_turnitin)); + Storage::disk('public')->put($request->nim.'/'.$bukti_sister_name, file_get_contents($bukti_sister)); + Storage::disk('public')->put($request->nim.'/'.$bukti_lembar_monitoring_name, file_get_contents($bukti_lembar_monitoring)); + Storage::disk('public')->put($request->nim.'/'.$bukti_naskah_dosen_pembimbing_name, file_get_contents($bukti_naskah_dosen_pembimbing)); + Storage::disk('public')->put($request->nim.'/'.$bukti_naskah_dosen_penguji_name, file_get_contents($bukti_naskah_dosen_penguji)); + return redirect()->route('layanan-sempro.tambah')->with('success','Sukses Tambah Data, Silahkan Menunggu Email Konfirmasi setelah disetujui Oleh Operator'); + } + + $data_mhs['nim'] = $request->nim; + $data_mhs['nama'] = $request->nama; + $data_mhs['nomor_hp'] = $request->nomor_hp; + $data_mhs['email'] = $request->email; + $data_mhs['judul_seminar_proposal'] = $request->judul_seminar_proposal; + $data_mhs['bagian'] = $request->bagian; + $data_mhs['dosen_dpu_id'] = $request->dosen_dpu; + $data_mhs['dosen_dpa_id'] = $request->dosen_dpa; + $data_mhs['dosen_penguji1_id'] = $request->dosen_penguji1; + $data_mhs['dosen_penguji2_id'] = $request->dosen_penguji2; + //set default values to - + $data_mhs['judul_skripsi_id'] = '-'; + $data_mhs['judul_skripsi_en'] = '-'; + $data_mhs['judul_jurnal'] = '-'; + $data_mhs['judul_artikel'] = '-'; + + + + + + + //save data mahasiswa dan pengajuan + if(Mahasiswa::create($data_mhs)){ + $mahasiswas_id = Mahasiswa::where('nim',$request->nim)->first(); + $data_sempro['mahasiswas_id'] = $mahasiswas_id->id; + $data_sempro['nilai_plagiasi'] = $request->nilai_plagiasi; + $data_sempro['bukti_hadir_sempro'] = $bukti_hadir_sempro_name; + $data_sempro['bukti_turnitin'] = $bukti_turnitin_name; + $data_sempro['bukti_sister'] = $bukti_sister_name; + $data_sempro['bukti_lembar_monitoring'] = $bukti_lembar_monitoring_name; + $data_sempro['bukti_naskah_dosen_pembimbing'] = $bukti_naskah_dosen_pembimbing_name; + $data_sempro['bukti_naskah_dosen_penguji'] = $bukti_naskah_dosen_penguji_name; + PengajuanSempro::create($data_sempro); + + Storage::disk('public')->put($request->nim.'/'.$bukti_hadir_sempro_name, file_get_contents($bukti_hadir_sempro)); + Storage::disk('public')->put($request->nim.'/'.$bukti_turnitin_name, file_get_contents($bukti_turnitin)); + Storage::disk('public')->put($request->nim.'/'.$bukti_sister_name, file_get_contents($bukti_sister)); + Storage::disk('public')->put($request->nim.'/'.$bukti_lembar_monitoring_name, file_get_contents($bukti_lembar_monitoring)); + Storage::disk('public')->put($request->nim.'/'.$bukti_naskah_dosen_pembimbing_name, file_get_contents($bukti_naskah_dosen_pembimbing)); + Storage::disk('public')->put($request->nim.'/'.$bukti_naskah_dosen_penguji_name, file_get_contents($bukti_naskah_dosen_penguji)); + return redirect()->route('layanan-sempro.tambah')->with('success','Sukses Tambah Data, Silahkan Menunggu Email Konfirmasi setelah disetujui Oleh Operator'); + } + return redirect()->route('layanan-sempro.tambah')->with('error','Gagal Tambah data, Cek kembali data yang anda masukkan'); + // $path = $request->nim.'/'.$file_transkrip_name; +} + +//done public function destroy(Request $request){ + $id = $request->id; + //cari data dan kirim notif sebelum dihapus + $data = PengajuanSempro::where('pengajuan_sempros.id',$id) + ->join('mahasiswas','mahasiswas_id','=','mahasiswas.id') + ->first(); + //data yang akan dikirim untuk dihapus + $data_job = [ + 'jenis' => 'penolakan', + 'nama' => $data->nama, + 'email' => $data->email, + 'created_at' => $data->created_at, + 'alasan' => $request->alasan, + ]; + //lokasi file + $path = [ + 'bukti_hadir_sempro' => $data->nim."/".$data->bukti_hadir_sempro, + 'bukti_turnitin' => $data->nim."/".$data->bukti_turnitin, + 'bukti_sister' => $data->nim."/".$data->bukti_sister, + 'bukti_lembar_monitoring' => $data->nim."/".$data->bukti_lembar_monitoring, + 'bukti_naskah_dosen_pembimbing' => $data->nim."/".$data->bukti_naskah_dosen_pembimbing, + 'bukti_naskah_dosen_penguji' => $data->nim."/".$data->bukti_naskah_dosen_penguji, + ]; + + //delete file + foreach($path as $item){ + try { + Storage::disk('public')->delete($item); + } + catch(Exception $e){ + $text['error'] = $e->getMessage(); + dispatch(new kirimNotifikasiErrorJob($text)); + exit; + } + } + + //delete data mahasiswa + try { + $dataDelete = PengajuanSempro::findOrFail($id); + $dataDelete->delete(); + //kirim notif ke mahasiswa bahwa ditolak + dispatch(new layananSeminarProposalJob($data_job)); + + }catch(Exception $e){ + //kirim notif error jika terjadi error + $text['error'] = $e->getMessage(); + dispatch(new kirimNotifikasiErrorJob($text)); + + return redirect()->route('layanan-sempro.index')->with('error','Error : '.$text['error']); + } + return redirect()->route('layanan-sempro.index')->with('success','Permintaan Sudah Diproses, Email akan segera dikirim ke penerima'); } +//done public function terima(Request $request){ + $id = $request->id; + $countcaseid = PengajuanSempro::where('ttd_operator','!=','-')->count(); + $caseid = "LP".date_format(date_create(),"ym").$countcaseid+1; + $cekData = PengajuanSempro::where('caseid',$caseid)->first(); + $data = PengajuanSempro::where('id',$id)->first(); + //cek apakah ada caseid yang sama sebelum disave + if(!is_null($cekData)){ + $data->updated_at = Carbon::now(); + $data->save(); + return redirect()->route('layanan-sempro.index')->with('error','Gagal simpan Data, Cek kembali Detail Data yang akan diterima'); + } + + $data->caseid = $caseid; + $data->ttd_operator = Carbon::now(); + if($data->save()){ + $data_job = [ + [ + 'jenis' => 'mahasiswa', + 'id' => $id, + ], + [ + 'jenis' => 'dpu', + 'id' => $id, + ], + ]; + foreach($data_job as $item){ + dispatch(new layananSeminarProposalJob($item)); + } + return redirect()->route('layanan-sempro.index')->with('success','Data Berhasil Disimpan, Email Akan Dikirimkan ke Mahasiswa, DPU dan DPA'); + } } +//done +public function ettd($caseid){ + $data = PengajuanSempro::where('caseid', $caseid) + ->select( + 'pengajuan_sempros.*', + 'mahasiswas.nama', + 'mahasiswas.nim', + 'mahasiswas.judul_seminar_proposal', + 'dosen_dpu.nama_gelar as dosen_dpu_nama_gelar', + ) + ->join('mahasiswas','pengajuan_sempros.mahasiswas_id','=','mahasiswas.id') + ->join('users as dosen_dpu','mahasiswas.dosen_dpu_id','=','dosen_dpu.id') + ->first(); + //jika data tidak null, maka render ini + if(!is_null($data)){ + $jenis = 'Dosen Pembimbing Utama'; + return view('layanan-sempro.ettd',['title'=> 'INPUT E-Signature','jenis'=>$jenis,'data'=> $data]); + } + //jika URL tidak diantara ketika itu maka render ini + return redirect()->route('laman-awal')->with(['error'=>'Invalid CASEID, Atau CaseID Tidak Ditemukan']); +} + +//done +public function submitettd($caseid, Request $request){ + $data = PengajuanSempro::where('caseid','=',$caseid)->first(); + //jika data ada, maka diproses + if(!is_null($data)){ + //cek ttd jika ttd sudah pernah diisi maka dikembalikan error + if($data->ttd_dpu!='-'){ + return redirect()->route('layanan-sempro.ettd',['caseid'=>$caseid])->with(['error'=>'CaseID Ini Sudah Pernah Anda Tandatangani Pada '.$data->ttd_dpu]); + } + $ttd = Mahasiswa::where('nim',$request->nim)->join('users as dosen_dpu','mahasiswas.dosen_dpu_id','=','dosen_dpu.id')->first(); + //jika Belum Pernah maka TTD akan diproses + if($ttd->ettd==$request->ettd){ + $data->ttd_dpu = Carbon::now(); + $data->save(); + $data_job =[ + 'jenis' => 'mahasiswa selesai', + 'id' => $data->id, + ]; + dispatch(new layananSeminarProposalJob($data_job)); + return redirect()->route('monitoring.caseid',['caseid'=>$caseid])->with(['success'=>'Terimakasih Telah Melakukan Tanda Tangan Pada CaseID '.$caseid]); + } + //jika ETTD Tidak sesuai Akan Dikembalikan Ke laman TTD Dengan error + else{ + return redirect()->route('layanan-sempro.ettd',['caseid'=>$caseid])->with(['error'=>'E-TTD Tidak Sesuai, Cek Kembali ETTD Anda']); + } + } +} + +//done +public function cetak($caseid){ + $data = PengajuanSempro::where('caseid', $caseid) + ->select( + 'pengajuan_sempros.*', + 'mahasiswas.nama', + 'bagians.nama_bagian', + 'mahasiswas.nim', + 'mahasiswas.judul_seminar_proposal', + 'dosen_dpu.nama_gelar as dosen_dpu_nama_gelar', + 'dosen_dpu.nip as dosen_dpu_nip', + ) + ->join('mahasiswas','pengajuan_sempros.mahasiswas_id','=','mahasiswas.id') + ->join('bagians','mahasiswas.bagian','=','bagians.id') + ->join('users as dosen_dpu','mahasiswas.dosen_dpu_id','=','dosen_dpu.id') + ->first(); + //jika data tidak null, maka render ini + if($data->ttd_dpu=='-'){ + return redirect()->route('monitoring.caseid',['caseid'=>$caseid])->with('error','Data Belum Di TandaTangani Oleh Dosen Pembimbing Utama, File Bisa didownload ketika DPU sudah tanda tangan!'); + } + if(is_null($data)){ + return redirect()->route('monitoring.caseid',['caseid'=>$caseid])->with('error','Data Dengan CASEID Tersebut Tidak ada'); + } + + $data = [ + 'title' => 'Cetak Kesediaan', + // 'date' => Carbon::now()->format('d-m-Y'), + 'date' => $data->created_at->format('d-m-Y'), + 'nama_mahasiswa' => $data->nama, + 'nim' => $data->nim, + 'bagian' => $data->nama_bagian, + 'judul_seminar_proposal' => $data->judul_seminar_proposal, + 'nilai_plagiasi' => $data->nilai_plagiasi, + 'dosen_dpu_nama_gelar' => $data->dosen_dpu_nama_gelar, + 'dosen_dpu_nip' => $data->dosen_dpu_nip, + 'dosen_dpu_qrcode' => base64_encode(QrCode::size(100)->generate($data->dosen_dpu_nama_gelar.'_TTD_'.$data->ttd_dpu)), + ]; + $pdf = Pdf::loadView('layanan-sempro.cetak', $data); + return $pdf->setPaper('a4', 'potrait')->stream($caseid.'-Kesediaan Menjadi Dosen Pembimbing Tugas Akhir'); + + //jika URL tidak diantara ketika itu maka render ini + +} } diff --git a/app/Http/Controllers/MonitoringController.php b/app/Http/Controllers/MonitoringController.php index 8b1a1a1..7ae356e 100644 --- a/app/Http/Controllers/MonitoringController.php +++ b/app/Http/Controllers/MonitoringController.php @@ -3,26 +3,61 @@ namespace App\Http\Controllers; use App\Models\PengajuanDpuDpa; +use App\Models\PengajuanSempro; use Illuminate\Http\Request; class MonitoringController extends Controller { +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){ - $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(); - return view('monitoring.dpu_dpa',['title' => 'Monitoring Pengajuan DPU/DPA - '.$caseid,'data' => $data]); + $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'); + } } } diff --git a/app/Jobs/kirimNotifikasiErrorJob.php b/app/Jobs/kirimNotifikasiErrorJob.php new file mode 100644 index 0000000..c0d13f5 --- /dev/null +++ b/app/Jobs/kirimNotifikasiErrorJob.php @@ -0,0 +1,34 @@ +data = $data; + } + + /** + * Execute the job. + */ + public function handle(): void + { + $text = $this->data['error']; + Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') + ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) + ->get(); + } +} diff --git a/app/Jobs/layananSeminarProposalJob.php b/app/Jobs/layananSeminarProposalJob.php new file mode 100644 index 0000000..9818999 --- /dev/null +++ b/app/Jobs/layananSeminarProposalJob.php @@ -0,0 +1,105 @@ +data = $data; + } + + /** + * Execute the job. + */ + public function handle(): void + { + if($this->data['jenis']==="penolakan"){ + $text = "BETA\n". + "Penolakan Pengajuan Seminar Proposal Mahasiswa: ".$this->data['nama']."\n". + "Dengan Email : ".$this->data['email']."\n\n". + "Alasan : ".$this->data['alasan']; + Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') + ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) + ->get(); + } + elseif($this->data['jenis'] == 'dpu'){ + $data = PengajuanSempro::where('pengajuan_sempros.id',$this->data['id']) + ->select( + 'pengajuan_sempros.caseid', + 'pengajuan_sempros.nilai_plagiasi', + 'mahasiswas.nama', + 'mahasiswas.nim', + 'mahasiswas.email', + 'mahasiswas.judul_seminar_proposal', + 'mahasiswas.dosen_dpu_id',) + ->join('mahasiswas','mahasiswas.id','=','mahasiswas_id') + ->first(); + $text = "BETA - ".$data->caseid."\n". + "Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n". + "Kepada mahasiswa : ".$data->nama."\n\n". + "Alamat Email : ".$data->email; + Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') + ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) + ->get(); + } + elseif($this->data['jenis'] == 'mahasiswa selesai'){ + $data = PengajuanSempro::where('pengajuan_sempros.id',$this->data['id']) + ->select( + 'pengajuan_sempros.caseid', + 'pengajuan_sempros.nilai_plagiasi', + 'mahasiswas.nama', + 'mahasiswas.nim', + 'mahasiswas.judul_seminar_proposal', + 'mahasiswas.dosen_dpu_id', + 'users.nama_gelar', + 'users.email') + ->join('mahasiswas','mahasiswas.id','=','mahasiswas_id') + ->join('users','users.id','=','dosen_dpu_id') + ->first(); + $text = "BETA - ".$data->caseid."\n". + "Pengajuan Selesai A/N Mahasiswa: ".$data->nama."\n". + "Kepada DPU : ".$data->nama_gelar."\n\n". + "Alamat Email : ".$data->email; + Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') + ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) + ->get(); + } + elseif($this->data['jenis'] == 'mahasiswa'){ + $data = PengajuanSempro::where('pengajuan_sempros.id',$this->data['id']) + ->select( + 'pengajuan_sempros.caseid', + 'pengajuan_sempros.nilai_plagiasi', + 'mahasiswas.nama', + 'mahasiswas.nim', + 'mahasiswas.judul_seminar_proposal', + 'mahasiswas.dosen_dpu_id', + 'users.nama_gelar', + 'users.email') + ->join('mahasiswas','mahasiswas.id','=','mahasiswas_id') + ->join('users','users.id','=','dosen_dpu_id') + ->first(); + $text = "BETA - ".$data->caseid."\n". + "Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n". + "Kepada DPU : ".$data->nama_gelar."\n\n". + "Alamat Email : ".$data->email; + Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') + ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) + ->get(); + } + } +} diff --git a/app/Models/Bagian.php b/app/Models/Bagian.php new file mode 100644 index 0000000..fbec3f3 --- /dev/null +++ b/app/Models/Bagian.php @@ -0,0 +1,11 @@ +id(); - $table->string('caseid'); + $table->string('caseid')->default('-'); $table->foreignId('mahasiswas_id')->constrained(); - $table->string('ttd_operator'); - $table->string('ttd_dpu'); + $table->string('ttd_operator')->default('-'); + $table->string('ttd_dpu')->default('-'); $table->integer('nilai_plagiasi'); $table->string('bukti_hadir_sempro'); $table->string('bukti_turnitin'); diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php new file mode 100644 index 0000000..a0e8512 --- /dev/null +++ b/resources/views/index.blade.php @@ -0,0 +1,30 @@ +@if($errors->any()) +