Commit 383c6935 by Muhammad Iskandar Java

Merge branch 'master' of http://git.unesa.ac.id/alfiro/simpmw

parents 0d4879d3 764f7e4c
@extends('layouts.master') @extends('layouts.master')
@section('css') @section('css')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css"> {{-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css"> --}}
@endsection @endsection
@section('title') @section('title')
...@@ -59,12 +59,6 @@ ...@@ -59,12 +59,6 @@
<div class="table-responsive"> <div class="table-responsive">
<table id="datatable" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;"> <table id="datatable" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead style="text-align: center; vertical-align: middle;"> <thead style="text-align: center; vertical-align: middle;">
{{-- <style>
th {
text-align: center;
vertical-align: middle;
}
</style> --}}
<tr> <tr>
<th>No</th> <th>No</th>
<th width="5%">Kode Kelompok</th> <th width="5%">Kode Kelompok</th>
...@@ -72,7 +66,7 @@ ...@@ -72,7 +66,7 @@
<th>Identitas Dosen Pembimbing</th> <th>Identitas Dosen Pembimbing</th>
<th>Kategori PMW</th> <th>Kategori PMW</th>
<th>Judul Proposal</th> <th>Judul Proposal</th>
<th>Usulan Dana</th> <th>Usulan Anggaran</th>
<th>Status</th> <th>Status</th>
<th>Aksi</th> <th>Aksi</th>
</tr> </tr>
...@@ -179,6 +173,7 @@ ...@@ -179,6 +173,7 @@
@dd($item->rProposalUrl->url); @dd($item->rProposalUrl->url);
@endphp --}} @endphp --}}
<button id="preview-video" class="btn btn-success btn-sm" data-video="{{ $item->rProposalUrl->url }}"> <button id="preview-video" class="btn btn-success btn-sm" data-video="{{ $item->rProposalUrl->url }}">
{{-- <button id="preview-video" class="btn btn-success btn-sm" data-video="https://youtu.be/9CHu8iOsxDE?feature=shared"> --}}
<i class="far fa-eye"></i> Lihat Video <i class="far fa-eye"></i> Lihat Video
</button> </button>
@else @else
...@@ -256,52 +251,67 @@ ...@@ -256,52 +251,67 @@
$(document).ready(function() { $(document).ready(function() {
// Event handler untuk tombol "Lihat Video" dengan ID preview-video // Event handler untuk tombol "Lihat Video" dengan ID preview-video
$('#preview-video').on('click', function() { $('#preview-video').on('click', function() {
var videoUrl = $(this).data('video'); var videoUrl = $(this).attr('data-video');
// console.log(videoUrl);
if (videoUrl) { if (videoUrl) {
// Buka video dalam Magnific Popup // Buka video dalam Magnific Popup
$.magnificPopup.open({ if (videoUrl.includes('youtu.be')) {
items: { // Konversi ke format youtube.com/watch?v=xxxxx
src: videoUrl videoUrl = videoUrl.replace('youtu.be/', 'youtube.com/watch?v=');
}, }
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() {
// Sembunyikan modal lama saat Magnific Popup dibuka
$('#{{ 'lihat'.$item->proposal_id }}').modal('hide');
// Mulai autoplay video setelah Magnific Popup dibuka // Buka video dalam Magnific Popup jika valid, buka di tab baru jika tidak
var iframe = this.content.find('iframe'); if (isValidYouTubeUrl(videoUrl)) {
if (iframe.length > 0) { $.magnificPopup.open({
var videoSrc = iframe.attr('src'); items: {
iframe.attr('src', videoSrc + '&autoplay=1'); // Tambahkan autoplay=1 ke URL video 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>'
}, },
close: function() { callbacks: {
// Tampilkan kembali modal lama setelah Magnific Popup ditutup open: function() {
$('#{{ 'lihat'.$item->proposal_id }}').modal('show'); // Sembunyikan modal lama saat Magnific Popup dibuka
$('#{{ 'lihat'.$item->proposal_id }}').modal('hide');
// Hentikan autoplay video saat Magnific Popup ditutup // Mulai autoplay video setelah Magnific Popup dibuka
var iframe = this.content.find('iframe'); var iframe = this.content.find('iframe');
if (iframe.length > 0) { if (iframe.length > 0) {
var videoSrc = iframe.attr('src'); var videoSrc = iframe.attr('src');
iframe.attr('src', videoSrc.replace('&autoplay=1', '')); // Hapus autoplay=1 dari URL video iframe.attr('src', videoSrc + '&autoplay=1'); // Tambahkan autoplay=1 ke URL video
}
},
close: function() {
// Tampilkan kembali modal lama setelah Magnific Popup ditutup
$('#{{ 'lihat'.$item->proposal_id }}').modal('show');
// Hentikan autoplay video saat Magnific Popup ditutup
var iframe = this.content.find('iframe');
if (iframe.length > 0) {
var videoSrc = iframe.attr('src');
iframe.attr('src', videoSrc.replace('&autoplay=1', '')); // Hapus autoplay=1 dari URL video
}
} }
} }
});
} else {
// Tampilkan pesan kesalahan jika URL video tidak valid
window.open(videoUrl, '_blank');
} }
}); } else {
} else { console.error('URL video tidak valid:', videoUrl);
// Tampilkan pesan kesalahan jika URL video tidak valid }
console.error('URL video tidak valid:', videoUrl); });
function isValidYouTubeUrl(url) {
// Lakukan validasi sederhana menggunakan ekspresi reguler
return /^(http(s)?:\/\/)?((w){3}.)?youtu(be|.be)?(\.com)?\/.+/gm.test(url);
} }
}); });
});
</script> </script>
@endif @endif
......
...@@ -107,6 +107,9 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () { ...@@ -107,6 +107,9 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route::get('/monev-revisi/{id}', [MonevMahasiswa::class, 'revisiMonev'])->name('monev-revisi'); Route::get('/monev-revisi/{id}', [MonevMahasiswa::class, 'revisiMonev'])->name('monev-revisi');
Route::post('/monev-revisi/upload', [MonevMahasiswa::class, 'uploadMonev'])->name('monev-revisi-upload'); Route::post('/monev-revisi/upload', [MonevMahasiswa::class, 'uploadMonev'])->name('monev-revisi-upload');
//monev-ii -> anggaran
Route::get('/monev/II/anggaran/{id}', [MonevMahasiswa::class, 'buktiAnggaran'])->name('monev-anggaran');
//luaran //luaran
Route::resource('luaran', LuaranMahasiswa::class); Route::resource('luaran', LuaranMahasiswa::class);
Route::post('/luaran-hapus', [LuaranMahasiswa::class, 'hapus'])->name('luaran.hapus'); Route::post('/luaran-hapus', [LuaranMahasiswa::class, 'hapus'])->name('luaran.hapus');
......
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