Commit 72f68373 by Alfiro Pratama

Tambah tombol Detail Daftar Proposal

parent 622559ab
......@@ -132,6 +132,7 @@ class DaftarProposalController extends Controller
$kode = $record->kode;
$jenis_pkm = $record->jenis_pkm;
$judul = $record->judul;
$upload_dokumen = $record->upload_dokumen;
$dospem = "(".str_replace("###",") ",$record->identitas_dospem);
$status_administrasi_1 = $record->status_administrasi;
$status_administrasi_2 = $record->status_administrasi_2;
......@@ -141,6 +142,8 @@ class DaftarProposalController extends Controller
$nilai_1 = $record->nilai_1;
$nilai_2 = $record->nilai_2;
$rata = $record->rata;
$url = "https://statik.unesa.ac.id/simpmw/proposal/".$record->periode."/".$record->upload_dokumen;
$video = DaftarProposal::where('proposal_id', $proposal_id)->pluck('url');
// $nilai_1= DB::select("select ambil_jumlah_penilaian_seleksi('".$reviewer_proposal_id_1."', '".$record->jenis_id."')")[0]->ambil_jumlah_penilaian_seleksi;
......@@ -278,12 +281,134 @@ class DaftarProposalController extends Controller
{
$aksi = '<td class="table-action">
<div align="center">
<a href="#!" style="margin-right: 3px;" class="btn btn-icon-sm btn-success" onclick="'.$lolos.'"><i class="fas fa-check"></i></a>
<a href="#!" class="btn btn-icon-sm btn-danger" onclick="'.$tidak_lolos.'"><i class="fas fa-ban"></i></a>
<a href="#!" data-toggle="tooltip" data-placement="top" title="Lolos" class="btn btn-icon-sm btn-success" onclick="'.$lolos.'"><i class="fas fa-check"></i></a>
<a href="#!" class="btn btn-icon-sm btn-danger" data-toggle="tooltip" data-placement="top" title="Tidak Lolos" onclick="'.$tidak_lolos.'"><i class="fas fa-ban"></i></a>
<a href="#" class="btn btn-icon-sm btn-primary" data-toggle="tooltip" data-placement="top" title="Lihat Detail" data-bs-toggle="modal" data-bs-target="#proposalModal' . $proposal_id . '"><i class="fas fa-search"></i></a>
</div>
</td>';
}
$aksi .= '
<div class="modal fade" id="proposalModal' . $proposal_id . '" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Proposal</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="table-responsive">
<table class="table mb-0">
<tr>
<th>Judul Proposal</th>
<td>' . $judul . '</td>
</tr>
<tr>
<th>Kategori PMW</th>
<td>' . $jenis_pkm . '</td>
</tr>
<tr>
<th>Proposal</th>
<td>';
if ($upload_dokumen) {
$aksi .= '<a href="' . $url . '" target="_blank" class="btn btn-success btn-sm">
<i class="far fa-eye"></i> Lihat Proposal
</a>';
} else {
$aksi .= '<div class="alert alert-danger alert-dismissible fade show mb-0" role="alert">
<strong>Informasi!</strong> File tidak ditemukan.
</div>';
}
$aksi .= '</td>
</tr>
<tr>
<th>Video Produk</th>
<td>';
foreach ($video as $item) {
if ($item&& preg_match('/(http|https|www.|\.com|\.co.id|\.org)/i', $item)) {
$aksi .= '<button id="preview-video' . $proposal_id . '" class="btn btn-success btn-sm" data-video="' . $item . '">
<i class="far fa-eye"></i> Lihat Video
</button>';
} else {
$aksi .= '<div class="alert alert-danger alert-dismissible fade show mb-0" role="alert">
<strong>Informasi!</strong> File tidak ditemukan.
</div>';
}
}
$aksi .= '</td>
</tr>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>';
// JavaScript untuk membuka video dalam Magnific Popup
$aksi .= "
<script>
$(document).ready(function() {
$('#preview-video" . $proposal_id . "').on('click', function() {
var videoUrl = $(this).attr('data-video');
if (videoUrl) {
if (videoUrl.includes('youtu.be')) {
videoUrl = videoUrl.replace('youtu.be/', 'youtube.com/watch?v=');
}
if (videoUrl.includes('youtu.be')) {
videoUrl = videoUrl.split('?')[0];
} else if (videoUrl.includes('youtube.com/watch?v=')) {
videoUrl = videoUrl.split('&')[0];
}
if (isValidYouTubeUrl(videoUrl)) {
var currentModal = $('#proposalModal" . $proposal_id . "');
$.magnificPopup.open({
items: {
src: videoUrl
},
type: 'iframe',
iframe: {
markup: '<div class=\"mfp-iframe-scaler\">'+
'<div class=\"mfp-close\"></div>'+
'<iframe class=\"mfp-iframe\" frameborder=\"0\" allowfullscreen allow=\"autoplay\"></iframe>'+
'</div>'
},
callbacks: {
open: function() {
currentModal.modal('hide');
var iframe = this.content.find('iframe');
if (iframe.length > 0) {
var videoSrc = iframe.attr('src');
iframe.attr('src', videoSrc + '&autoplay=1');
}
},
close: function() {
currentModal.modal('show');
var iframe = this.content.find('iframe');
if (iframe.length > 0) {
var videoSrc = iframe.attr('src');
iframe.attr('src', videoSrc.replace('&autoplay=1', ''));
}
}
}
});
} else {
window.open(videoUrl, '_blank');
}
} else {
console.error('URL video tidak valid:', videoUrl);
}
});
function isValidYouTubeUrl(url) {
return /^(http(s)?:\\/\\/)?((w){3}.)?youtu(be|.be)?(\\.com)?\\/.+/gm.test(url);
}
});
</script>
";
$pendanaan = '
<td>
Usulan Dana: Rp'.number_format($record->usulan_dana, 0, ",", ",").'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment