2024-03-20 17:08:09 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
2024-03-30 19:43:46 +07:00
|
|
|
use App\Mail\pengajuanSidangAkhirMail;
|
2024-03-20 17:08:09 +07:00
|
|
|
use App\Models\PengajuanSidangAkhir;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
2024-03-30 19:43:46 +07:00
|
|
|
use Illuminate\Support\Facades\Mail;
|
2024-03-20 17:08:09 +07:00
|
|
|
use Ixudra\Curl\Facades\Curl;
|
|
|
|
|
|
|
|
class layananSidangAkhirJob implements ShouldQueue
|
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
|
|
public $data;
|
|
|
|
public function __construct($data)
|
|
|
|
{
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*/
|
|
|
|
public function handle(): void
|
|
|
|
{
|
|
|
|
if($this->data['jenis']==="penolakan"){
|
2024-03-30 19:43:46 +07:00
|
|
|
$data = [
|
|
|
|
'caseid' => $this->data['caseid'],
|
|
|
|
'nama_mahasiswa' => $this->data['nama_mahasiswa'],
|
|
|
|
'nim_mahasiswa' => $this->data['nim_mahasiswa'],
|
|
|
|
'judul_skripsi_id' => $this->data['judul_skripsi_id'],
|
|
|
|
'judul_skripsi_en' => $this->data['judul_skripsi_en'],
|
|
|
|
'subject' => $this->data['caseid'].' - Penolakan Pengajuan Untuk Sidang Akhir',
|
|
|
|
'jenis' => $this->data['jenis'],
|
|
|
|
'judul' => 'Pengajuan Untuk Sidang Akhir',
|
|
|
|
'alasan' => $this->data['alasan'],
|
|
|
|
];
|
|
|
|
|
|
|
|
//send email
|
|
|
|
$konten = new pengajuanSidangAkhirMail($data);
|
|
|
|
Mail::to($this->data['email'])
|
|
|
|
->bcc('f@unej.ac.id')
|
|
|
|
->send($konten);
|
|
|
|
|
|
|
|
//telegram
|
2024-03-20 17:08:09 +07:00
|
|
|
$text = "BETA\n".
|
2024-03-30 19:43:46 +07:00
|
|
|
"Penolakan Pengajuan Untuk Sidang Akhir Mahasiswa: ".$this->data['nama_mahasiswa']."\n".
|
2024-03-20 17:08:09 +07:00
|
|
|
"Dengan Email : ".$this->data['email']."\n\n".
|
|
|
|
"Alasan : ".$this->data['alasan'];
|
2024-03-30 19:43:46 +07:00
|
|
|
|
|
|
|
//send telegram
|
2024-03-20 17:08:09 +07:00
|
|
|
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 = PengajuanSidangAkhir::where('pengajuan_sidang_akhirs.id',$this->data['id'])
|
|
|
|
->select(
|
|
|
|
'pengajuan_sidang_akhirs.caseid',
|
2024-03-30 19:43:46 +07:00
|
|
|
'mahasiswas.nama as nama_mahasiswa',
|
|
|
|
'mahasiswas.nim as nim_mahasiswa',
|
2024-03-20 17:08:09 +07:00
|
|
|
'mahasiswas.email',
|
|
|
|
'mahasiswas.judul_skripsi_id',
|
2024-03-30 19:43:46 +07:00
|
|
|
'mahasiswas.judul_skripsi_en',)
|
2024-03-20 17:08:09 +07:00
|
|
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
|
|
|
->first();
|
2024-03-30 19:43:46 +07:00
|
|
|
$data_email = [
|
|
|
|
'caseid' => $data->caseid,
|
|
|
|
'nama_mahasiswa' => $data->nama_mahasiswa,
|
|
|
|
'nim_mahasiswa' => $data->nim_mahasiswa,
|
|
|
|
'judul_skripsi_id' => $data->judul_skripsi_id,
|
|
|
|
'judul_skripsi_en' => $data->judul_skripsi_en,
|
|
|
|
'subject' => $data->caseid.' - Kesediaan Pengajuan Untuk Sidang Akhir',
|
|
|
|
'email' => $data->email,
|
|
|
|
'jenis' => $this->data['jenis'],
|
|
|
|
'url' => route('monitoring.caseid',['caseid'=>$data->caseid]),
|
|
|
|
];
|
|
|
|
|
|
|
|
//send email
|
|
|
|
$konten = new pengajuanSidangAkhirMail($data_email);
|
|
|
|
Mail::to($data_email['email'])
|
|
|
|
->bcc('f@unej.ac.id')
|
|
|
|
->send($konten);
|
|
|
|
|
|
|
|
//telegram
|
|
|
|
$text = "BETA\n".
|
|
|
|
"Kirim Pengajuan CaseID :". $data->caseid ."\n\nA/N Mahasiswa: ".$data->nama_mahasiswa."\n".
|
|
|
|
"Kepada mahasiswa : ".$data->nama_mahasiswa."\n\n".
|
2024-03-20 17:08:09 +07:00
|
|
|
"Alamat Email : ".str_replace('_','\_',$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 = PengajuanSidangAkhir::where('pengajuan_sidang_akhirs.id',$this->data['id'])
|
|
|
|
->select(
|
|
|
|
'pengajuan_sidang_akhirs.caseid',
|
2024-03-30 19:43:46 +07:00
|
|
|
'mahasiswas.nama as nama_mahasiswa',
|
|
|
|
'mahasiswas.nim as nim_mahasiswa',
|
|
|
|
'mahasiswas.email',
|
|
|
|
'mahasiswas.judul_skripsi_id',
|
|
|
|
'mahasiswas.judul_skripsi_en',
|
|
|
|
'mahasiswas.dosen_dpu_id')
|
2024-03-20 17:08:09 +07:00
|
|
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
|
|
|
->first();
|
2024-03-30 19:43:46 +07:00
|
|
|
|
|
|
|
//data email
|
|
|
|
$data_email = [
|
|
|
|
'caseid' => $data->caseid,
|
|
|
|
'nama_mahasiswa' => $data->nama_mahasiswa,
|
|
|
|
'nim_mahasiswa' => $data->nim_mahasiswa,
|
|
|
|
'judul_skripsi_id' => $data->judul_skripsi_id,
|
|
|
|
'judul_skripsi_en' => $data->judul_skripsi_en,
|
|
|
|
'subject' => $data->caseid.' - Pengajuan Untuk Sidang Akhir',
|
|
|
|
'email' => $data->email,
|
|
|
|
'jenis' => $this->data['jenis'],
|
|
|
|
'url' => route('layanan-sidangakhir.cetak',['caseid'=>$data->caseid]),
|
|
|
|
];
|
|
|
|
|
|
|
|
//send email
|
|
|
|
$konten = new pengajuanSidangAkhirMail($data_email);
|
|
|
|
Mail::to($data_email['email'])
|
|
|
|
->bcc('f@unej.ac.id')
|
|
|
|
->send($konten);
|
|
|
|
|
|
|
|
//telegram
|
|
|
|
$text = "BETA\n".
|
|
|
|
"Pengajuan Selesai CaseID :". $data->caseid ."\n\nA/N Mahasiswa: ".$data->nama_mahasiswa."\n".
|
|
|
|
"Kepada mahasiswa : ".$data->nama_mahasiswa."\n\n".
|
2024-03-20 17:08:09 +07:00
|
|
|
"Alamat Email : ".str_replace('_','\_',$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'] == 'dpu'){
|
|
|
|
$data = PengajuanSidangAkhir::where('pengajuan_sidang_akhirs.id',$this->data['id'])
|
|
|
|
->select(
|
|
|
|
'pengajuan_sidang_akhirs.caseid',
|
|
|
|
'pengajuan_sidang_akhirs.nilai_plagiasi',
|
2024-03-30 19:43:46 +07:00
|
|
|
'mahasiswas.nama as nama_mahasiswa',
|
|
|
|
'mahasiswas.nim as nim_mahasiswa',
|
|
|
|
'mahasiswas.judul_skripsi_id',
|
|
|
|
'mahasiswas.judul_skripsi_en',
|
2024-03-20 17:08:09 +07:00
|
|
|
'mahasiswas.dosen_dpu_id',
|
|
|
|
'users.nama_gelar',
|
|
|
|
'users.email')
|
|
|
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
|
|
|
->join('users','users.id','=','dosen_dpu_id')
|
|
|
|
->first();
|
2024-03-30 19:43:46 +07:00
|
|
|
//data email
|
|
|
|
$data_email = [
|
|
|
|
'caseid' => $data->caseid,
|
|
|
|
'nama_mahasiswa' => $data->nama_mahasiswa,
|
|
|
|
'nim_mahasiswa' => $data->nim_mahasiswa,
|
|
|
|
'judul_skripsi_id' => $data->judul_skripsi_id,
|
|
|
|
'judul_skripsi_en' => $data->judul_skripsi_en,
|
|
|
|
'subject' => $data->caseid.' - Pengajuan Untuk Sidang Akhir',
|
|
|
|
'nama_dosen' => $data->nama_gelar,
|
|
|
|
'email' => $data->email,
|
|
|
|
'jenis' => $this->data['jenis'],
|
|
|
|
'url' => route('layanan-sidangakhir.ettd',['caseid'=>$data->caseid]),
|
|
|
|
];
|
|
|
|
|
|
|
|
//send email
|
|
|
|
$konten = new pengajuanSidangAkhirMail($data_email);
|
|
|
|
Mail::to($data_email['email'])
|
|
|
|
->bcc('f@unej.ac.id')
|
|
|
|
->send($konten);
|
|
|
|
|
|
|
|
|
|
|
|
//telegram
|
|
|
|
$text = "BETA\n".
|
|
|
|
"Kirim Pengajuan CaseID :". $data->caseid ."\n\nA/N Mahasiswa: ".$data->nama_mahasiswa."\n".
|
2024-03-20 17:08:09 +07:00
|
|
|
"Kepada DPU : ".$data->nama_gelar."\n\n".
|
|
|
|
"Alamat Email : ".str_replace('_','\_',$data->email);
|
|
|
|
Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage')
|
|
|
|
->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') )
|
|
|
|
->get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|