pintu2/app/Jobs/layananPengajuanWisudaJob.php
efbe 3b60021799
All checks were successful
Run Action to Production / run pull to sync on target message (push) Has been skipped
fix edit mahasiswa
2024-04-17 16:27:09 +07:00

481 lines
22 KiB
PHP

<?php
namespace App\Jobs;
use App\Mail\pengajuanWisudaMail;
use App\Models\PengajuanWisuda;
use App\Models\User;
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 layananPengajuanWisudaJob 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'],
'subject' => $this->data['caseid'].' - Penolakan Pengajuan Syarat Wisuda / Yudisium',
'jenis' => $this->data['jenis'],
'judul' => 'Penolakan Pengajuan Syarat Wisuda',
'alasan' => $this->data['alasan'],
];
//send email
$konten = new pengajuanWisudaMail($data);
Mail::to($this->data['email'])
->bcc('f@unej.ac.id')
->send($konten);
//telegram
$text = "BETA\n".
"Penolakan Pengajuan Syarat Wisuda 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 = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
'mahasiswas.email',
)
->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,
'subject' => $data->caseid.' - Kesediaan Pengajuan Syarat Wisuda / Yudisium',
'email' => $data->email,
'jenis' => $this->data['jenis'],
'url' => route('monitoring.caseid',['caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
'mahasiswas.email',
)
->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,
'subject' => $data->caseid.' - Kesediaan Pengajuan Syarat Wisuda / Yudisium',
'email' => $data->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.cetak',['caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
'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,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $data->nama_gelar,
'email' => $data->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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']==='dpa'){
$data = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
'mahasiswas.dosen_dpa_id',
'users.nama_gelar',
'users.email')
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
->join('users','users.id','=','dosen_dpa_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,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $data->nama_gelar,
'email' => $data->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 DPA : ".$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 = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
'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,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $data->nama_gelar,
'email' => $data->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
'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,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $data->nama_gelar,
'email' => $data->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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();
}
elseif($this->data['jenis']==='kalab'){
$user = User::whereHas('roles', function ($query) {
$query->where('name', 'like', '%Kalab%');
})
->get();
$data = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
)
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
->first();
foreach ($user as $item){
//data email
$data_email = [
'caseid' => $data->caseid,
'nama_mahasiswa' => $data->nama_mahasiswa,
'nim_mahasiswa' => $data->nim_mahasiswa,
'judul_skripsi_id' => $data->judul_skripsi_id,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $item->nama_gelar,
'email' => $item->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 Kalab : ".$item->nama_gelar."\n\n".
"Alamat Email : ".str_replace('_','\_',$item->nama_gelar);
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']==='skpi'){
$user = User::whereHas('roles', function ($query) {
$query->where('name', 'like', '%skpi%');
})
->get();
$data = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
)
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
->first();
foreach ($user as $item){
//data email
$data_email = [
'caseid' => $data->caseid,
'nama_mahasiswa' => $data->nama_mahasiswa,
'nim_mahasiswa' => $data->nim_mahasiswa,
'judul_skripsi_id' => $data->judul_skripsi_id,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $item->nama_gelar,
'email' => $item->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 Pj. SKPI : ".$item->nama_gelar."\n\n".
"Alamat Email : ".str_replace('_','\_',$item->nama_gelar);
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']==='perpustakaan'){
$user = User::whereHas('roles', function ($query) {
$query->where('name', 'like', '%perpustakaan%');
})
->get();
$data = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
)
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
->first();
foreach ($user as $item){
//data email
$data_email = [
'caseid' => $data->caseid,
'nama_mahasiswa' => $data->nama_mahasiswa,
'nim_mahasiswa' => $data->nim_mahasiswa,
'judul_skripsi_id' => $data->judul_skripsi_id,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $item->nama_gelar,
'email' => $item->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 Pj. Perpustakaan /Ruang Baca : ".$item->nama_gelar."\n\n".
"Alamat Email : ".str_replace('_','\_',$item->nama_gelar);
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']==='wakildekan1'){
$user = User::whereHas('roles', function ($query) {
$query->where('name', 'like', '%Wakil Dekan 1%');
})
->get();
$data = PengajuanWisuda::where('pengajuan_wisudas.id',$this->data['id'])
->select(
'pengajuan_wisudas.caseid',
'mahasiswas.nama as nama_mahasiswa',
'mahasiswas.nim as nim_mahasiswa',
'mahasiswas.judul_skripsi_id',
)
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
->first();
foreach ($user as $item){
//data email
$data_email = [
'caseid' => $data->caseid,
'nama_mahasiswa' => $data->nama_mahasiswa,
'nim_mahasiswa' => $data->nim_mahasiswa,
'judul_skripsi_id' => $data->judul_skripsi_id,
'subject' => $data->caseid.' - Pengajuan Untuk Syarat Wisuda / Yudisium',
'nama_dosen' => $item->nama_gelar,
'email' => $item->email,
'jenis' => $this->data['jenis'],
'url' => route('layanan-wisuda.ettd',['url'=>$this->data['jenis'], 'caseid'=>$data->caseid]),
];
//send email
$konten = new pengajuanWisudaMail($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 Wakil Dekan 1 : ".$item->nama_gelar."\n\n".
"Alamat Email : ".str_replace('_','\_',$item->nama_gelar);
Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage')
->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') )
->get();
}
}
}
}