281 lines
13 KiB
PHP
281 lines
13 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Jobs;
|
||
|
|
||
|
use App\Mail\pengajuanRevisiPublikasiMail;
|
||
|
use App\Models\PengajuanRevisiPublikasi;
|
||
|
use Illuminate\Bus\Queueable;
|
||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||
|
use Illuminate\Queue\InteractsWithQueue;
|
||
|
use Illuminate\Queue\SerializesModels;
|
||
|
use Illuminate\Support\Facades\Mail;
|
||
|
use Ixudra\Curl\Facades\Curl;
|
||
|
|
||
|
class layananRevisiPublikasiJob 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"){
|
||
|
$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_artikel' => $this->data['judul_artikel'],
|
||
|
'judul_jurnal' => $this->data['judul_jurnal'],
|
||
|
'subject' => $this->data['caseid'].' - Penolakan Pengajuan Untuk Revisi / Publikasi',
|
||
|
'jenis' => $this->data['jenis'],
|
||
|
'judul' => 'Pengajuan Untuk Revisi / Publikasi',
|
||
|
'alasan' => $this->data['alasan'],
|
||
|
];
|
||
|
|
||
|
//send email
|
||
|
$konten = new pengajuanRevisiPublikasiMail($data);
|
||
|
Mail::to($this->data['email'])
|
||
|
->bcc('f@unej.ac.id')
|
||
|
->send($konten);
|
||
|
|
||
|
//telegram
|
||
|
$text = "BETA\n".
|
||
|
"Penolakan Pengajuan Untuk Revisi / Publikasi Mahasiswa: ".$this->data['nama_mahasiswa']."\n".
|
||
|
"Dengan Email : ".$this->data['email']."\n\n".
|
||
|
"Alasan : ".$this->data['alasan'];
|
||
|
|
||
|
//send telegram
|
||
|
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 = PengajuanRevisiPublikasi::where('pengajuan_revisi_publikasis.id',$this->data['id'])
|
||
|
->select(
|
||
|
'pengajuan_revisi_publikasis.caseid',
|
||
|
'mahasiswas.nama as nama_mahasiswa',
|
||
|
'mahasiswas.nim as nim_mahasiswa',
|
||
|
'mahasiswas.email',
|
||
|
'mahasiswas.judul_skripsi_id',
|
||
|
'mahasiswas.judul_jurnal',
|
||
|
'mahasiswas.judul_artikel',)
|
||
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
||
|
->first();
|
||
|
$data_email = [
|
||
|
'caseid' => $data->caseid,
|
||
|
'nama_mahasiswa' => $data->nama_mahasiswa,
|
||
|
'nim_mahasiswa' => $data->nim_mahasiswa,
|
||
|
'judul_skripsi_id' => $data->judul_skripsi_id,
|
||
|
'judul_jurnal' => $data->judul_jurnal,
|
||
|
'judul_artikel' => $data->judul_artikel,
|
||
|
'subject' => $data->caseid.' - Kesediaan Pengajuan Untuk Revisi / Publikasi',
|
||
|
'email' => $data->email,
|
||
|
'jenis' => $this->data['jenis'],
|
||
|
'url' => route('monitoring.caseid',['caseid'=>$data->caseid]),
|
||
|
];
|
||
|
|
||
|
//send email
|
||
|
$konten = new pengajuanRevisiPublikasiMail($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".
|
||
|
"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 = PengajuanRevisiPublikasi::where('pengajuan_revisi_publikasis.id',$this->data['id'])
|
||
|
->select(
|
||
|
'pengajuan_revisi_publikasis.caseid',
|
||
|
'mahasiswas.nama as nama_mahasiswa',
|
||
|
'mahasiswas.nim as nim_mahasiswa',
|
||
|
'mahasiswas.email',
|
||
|
'mahasiswas.judul_skripsi_id',
|
||
|
'mahasiswas.judul_jurnal',
|
||
|
'mahasiswas.judul_artikel')
|
||
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
||
|
->first();
|
||
|
|
||
|
//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_jurnal' => $data->judul_jurnal,
|
||
|
'judul_artikel' => $data->judul_artikel,
|
||
|
'subject' => $data->caseid.' - Pengajuan Untuk Revisi / Publikasi',
|
||
|
'email' => $data->email,
|
||
|
'jenis' => $this->data['jenis'],
|
||
|
'url' => route('layanan-revisipublikasi.cetak',['caseid'=>$data->caseid]),
|
||
|
];
|
||
|
|
||
|
//send email
|
||
|
$konten = new pengajuanRevisiPublikasiMail($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".
|
||
|
"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 = PengajuanRevisiPublikasi::where('pengajuan_revisi_publikasis.id',$this->data['id'])
|
||
|
->select(
|
||
|
'pengajuan_revisi_publikasis.caseid',
|
||
|
'mahasiswas.nama as nama_mahasiswa',
|
||
|
'mahasiswas.nim as nim_mahasiswa',
|
||
|
'mahasiswas.judul_skripsi_id',
|
||
|
'mahasiswas.judul_jurnal',
|
||
|
'mahasiswas.judul_artikel',
|
||
|
'mahasiswas.dosen_dpu_id',
|
||
|
'users.nama_gelar',
|
||
|
'users.email')
|
||
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
||
|
->join('users','users.id','=','dosen_dpu_id')
|
||
|
->first();
|
||
|
//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_jurnal' => $data->judul_jurnal,
|
||
|
'judul_artikel' => $data->judul_artikel,
|
||
|
'subject' => $data->caseid.' - Pengajuan Untuk Revisi / Publikasi',
|
||
|
'nama_dosen' => $data->nama_gelar,
|
||
|
'email' => $data->email,
|
||
|
'jenis' => $this->data['jenis'],
|
||
|
'url' => route('layanan-revisipublikasi.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
|
||
|
];
|
||
|
|
||
|
//send email
|
||
|
$konten = new pengajuanRevisiPublikasiMail($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 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();
|
||
|
}
|
||
|
elseif($this->data['jenis'] == 'penguji1'){
|
||
|
$data = PengajuanRevisiPublikasi::where('pengajuan_revisi_publikasis.id',$this->data['id'])
|
||
|
->select(
|
||
|
'pengajuan_revisi_publikasis.caseid',
|
||
|
'mahasiswas.nama as nama_mahasiswa',
|
||
|
'mahasiswas.nim as nim_mahasiswa',
|
||
|
'mahasiswas.judul_skripsi_id',
|
||
|
'mahasiswas.judul_jurnal',
|
||
|
'mahasiswas.judul_artikel',
|
||
|
'mahasiswas.dosen_penguji1_id',
|
||
|
'users.nama_gelar',
|
||
|
'users.email')
|
||
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
||
|
->join('users','users.id','=','dosen_penguji1_id')
|
||
|
->first();
|
||
|
//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_jurnal' => $data->judul_jurnal,
|
||
|
'judul_artikel' => $data->judul_artikel,
|
||
|
'subject' => $data->caseid.' - Pengajuan Untuk Revisi / Publikasi',
|
||
|
'nama_dosen' => $data->nama_gelar,
|
||
|
'email' => $data->email,
|
||
|
'jenis' => $this->data['jenis'],
|
||
|
'url' => route('layanan-revisipublikasi.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
|
||
|
];
|
||
|
|
||
|
//send email
|
||
|
$konten = new pengajuanRevisiPublikasiMail($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 penguji1 : ".$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();
|
||
|
}
|
||
|
elseif($this->data['jenis'] == 'penguji2'){
|
||
|
$data = PengajuanRevisiPublikasi::where('pengajuan_revisi_publikasis.id',$this->data['id'])
|
||
|
->select(
|
||
|
'pengajuan_revisi_publikasis.caseid',
|
||
|
'mahasiswas.nama as nama_mahasiswa',
|
||
|
'mahasiswas.nim as nim_mahasiswa',
|
||
|
'mahasiswas.judul_skripsi_id',
|
||
|
'mahasiswas.judul_jurnal',
|
||
|
'mahasiswas.judul_artikel',
|
||
|
'mahasiswas.dosen_penguji2_id',
|
||
|
'users.nama_gelar',
|
||
|
'users.email')
|
||
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
||
|
->join('users','users.id','=','dosen_penguji2_id')
|
||
|
->first();
|
||
|
//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_jurnal' => $data->judul_jurnal,
|
||
|
'judul_artikel' => $data->judul_artikel,
|
||
|
'subject' => $data->caseid.' - Pengajuan Untuk Revisi / Publikasi',
|
||
|
'nama_dosen' => $data->nama_gelar,
|
||
|
'email' => $data->email,
|
||
|
'jenis' => $this->data['jenis'],
|
||
|
'url' => route('layanan-revisipublikasi.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
|
||
|
];
|
||
|
|
||
|
//send email
|
||
|
$konten = new pengajuanRevisiPublikasiMail($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 penguji2 : ".$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();
|
||
|
}
|
||
|
}
|
||
|
}
|