Commit 9cf90b69 by Alfiro Pratama

Upload Laporan Magang Monev I

parent 69f3f68d
...@@ -69,8 +69,10 @@ class LuaranController extends Controller ...@@ -69,8 +69,10 @@ class LuaranController extends Controller
'judul' => $luaran['judul'], 'judul' => $luaran['judul'],
'jenis_luaran' => $luaran['jenis_luaran'], 'jenis_luaran' => $luaran['jenis_luaran'],
'keterangan_luaran' => $luaran['keterangan_luaran'], 'keterangan_luaran' => $luaran['keterangan_luaran'],
'kategori_luaran' => $luaran['jenis_luaran_lainnya'] === 'Lainnya' ? $luaran['jenis_luaran_lainnya'] : null,
'file_luaran' => $file_nama, 'file_luaran' => $file_nama,
'created_user' => Auth::user()->id 'created_user' => Auth::user()->id,
'updated_user' => Auth::user()->id
]); ]);
return redirect()->route('mahasiswa.luaran.show', encrypt($luaran['proposal_id']))->with('success', 'Proposal Berhasil ditambahkan'); return redirect()->route('mahasiswa.luaran.show', encrypt($luaran['proposal_id']))->with('success', 'Proposal Berhasil ditambahkan');
...@@ -85,7 +87,7 @@ class LuaranController extends Controller ...@@ -85,7 +87,7 @@ class LuaranController extends Controller
public function show($id) public function show($id)
{ {
// //
$title = 'Proposal Luaran Mahasiswa'; $title = 'Unggah Laporan Magang Mahasiswa';
$proposal = Proposal::with(['rluaran', 'rPeriode'])->find(decrypt($id)); $proposal = Proposal::with(['rluaran', 'rPeriode'])->find(decrypt($id));
$data = [ $data = [
...@@ -100,15 +102,18 @@ class LuaranController extends Controller ...@@ -100,15 +102,18 @@ class LuaranController extends Controller
{ {
$pro = $request->except('_token'); $pro = $request->except('_token');
$proposal = Proposal::query()->find(decrypt($pro['id'])); // Dekripsi ID hanya sekali
$id = decrypt($pro['id']);
Storage::disk('static')->delete('simpmw/luaran/'.$proposal->jenis_luaran.'/'.$proposal->file_luaran); $proposal = ProposalLuaran::query()->find($id);
if ($proposal) {
Storage::disk('static')->delete('simpmw/luaran/'.$proposal->jenis_luaran.'/'.$proposal->file_luaran);
$proposal->delete(); $proposal->delete();
return response()->json(['status' => 'success', 'message' => 'Berhasil dihapus']);
Alert::success('Berhasil dihapus'); } else {
return response()->json(['status' => 'error', 'message' => 'Proposal tidak ditemukan']);
return redirect()->route('mahasiswa.luaran.index'); }
} }
public function dosen($id) public function dosen($id)
......
...@@ -176,7 +176,7 @@ class DaftarProposalController extends Controller ...@@ -176,7 +176,7 @@ class DaftarProposalController extends Controller
$lolos = "confirmFinal('".Crypt::encrypt($proposal_id)."', '1')"; $lolos = "confirmFinal('".Crypt::encrypt($proposal_id)."', '1')";
$tidak_lolos = "confirmFinal('".Crypt::encrypt($proposal_id)."', '2')"; $tidak_lolos = "confirmFinal('".Crypt::encrypt($proposal_id)."', '2')";
$batalkanNilai1 = // $batalkanNilai1 =
$disable_1 = $disable_2 = ''; $disable_1 = $disable_2 = '';
......
...@@ -39,7 +39,7 @@ class MonevProposalController extends Controller ...@@ -39,7 +39,7 @@ class MonevProposalController extends Controller
]; ];
$periode = Periode::query()->get(); $periode = Periode::query()->get();
$jenis = Jenis::query()->where('status_hapus', '0')->get(); $jenis = Jenis::query()->where('status_hapus', '0')->get();
return view('backend.operator.daftar_proposal.monev', compact('data', 'periode', 'jenis'))->withTitle('Daftar Proposal '.$jenis_monev->nama); return view('backend.operator.daftar_proposal.monev', compact('data', 'periode', 'jenis', 'jenis_monev'))->withTitle('Daftar Proposal '.$jenis_monev->nama);
} }
/* AJAX request */ /* AJAX request */
...@@ -115,6 +115,7 @@ class MonevProposalController extends Controller ...@@ -115,6 +115,7 @@ class MonevProposalController extends Controller
$kode = $record->kode; $kode = $record->kode;
$jenis_pkm = $record->jenis_pkm; $jenis_pkm = $record->jenis_pkm;
$judul = $record->judul; $judul = $record->judul;
$upload_dokumen = $record->upload_dokumen;
$dospem = "(".str_replace("###",") ",$record->identitas_dospem); $dospem = "(".str_replace("###",") ",$record->identitas_dospem);
$status_administrasi_1 = $record->status_administrasi_1; $status_administrasi_1 = $record->status_administrasi_1;
$status_administrasi_2 = $record->status_administrasi_2; $status_administrasi_2 = $record->status_administrasi_2;
...@@ -124,6 +125,9 @@ class MonevProposalController extends Controller ...@@ -124,6 +125,9 @@ class MonevProposalController extends Controller
$reviewer_id_2 = $record->reviewer_id_2; $reviewer_id_2 = $record->reviewer_id_2;
$status_final = $record->status; $status_final = $record->status;
$rata = $record->rata; $rata = $record->rata;
$video = DaftarProposalMonev::where('proposal_id', $proposal_id)
->where('monev_internal_id', $monev_internal_id)
->pluck('url');
// $rata = ($nilai_1 + $nilai_2) / 2; // $rata = ($nilai_1 + $nilai_2) / 2;
...@@ -189,9 +193,131 @@ class MonevProposalController extends Controller ...@@ -189,9 +193,131 @@ class MonevProposalController extends Controller
$aksi = '<td class="table-action"> $aksi = '<td class="table-action">
<a href="#!" class="btn btn-icon-sm btn-success" onclick="'.$lolos.'"><i class="fas fa-check"></i></a> <a href="#!" 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="#!" class="btn btn-icon-sm btn-danger" 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 . '-' . $monev_internal_id . '"><i class="fas fa-search"></i></a>
</td>'; </td>';
} }
$aksi .= '
<div class="modal fade" id="proposalModal' . $proposal_id . '-' . $monev_internal_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>
";
$data_arr[] = array( $data_arr[] = array(
"monev_internal_id" => $monev_internal_id, "monev_internal_id" => $monev_internal_id,
"kode" => $kode, "kode" => $kode,
......
...@@ -12,7 +12,7 @@ class DaftarProposal extends Model ...@@ -12,7 +12,7 @@ class DaftarProposal extends Model
protected $keyType = 'string'; protected $keyType = 'string';
protected $fillable = [ protected $fillable = [
'proposal_id', 'jenis_id', 'kode', 'jenis_pkm', 'judul', 'status', 'status_hapus', 'status_administrasi_1', 'status_administrasi_2', 'reviewer_id_1', 'reviewer_id_2', 'status_final', 'nidn_reviewer_id_1', 'nidn_reviewer_id_2', 'upload_dokumen', 'date_upload', 'date_approval', 'identitas_ketua', 'identitas_dospem', 'periode' 'proposal_id', 'jenis_id', 'kode', 'jenis_pkm', 'judul', 'status', 'status_hapus', 'status_administrasi_1', 'status_administrasi_2', 'reviewer_id_1', 'reviewer_id_2', 'status_final', 'nidn_reviewer_id_1', 'nidn_reviewer_id_2', 'upload_dokumen', 'date_upload', 'date_approval', 'identitas_ketua', 'identitas_dospem', 'periode', 'url'
]; ];
public function rKelompokDetil() public function rKelompokDetil()
......
...@@ -23,4 +23,9 @@ class DaftarProposalMonev extends Model ...@@ -23,4 +23,9 @@ class DaftarProposalMonev extends Model
{ {
return $this->hasMany(\App\Models\KelompokDetail::class, 'kelompok_id', 'kelompok_id'); return $this->hasMany(\App\Models\KelompokDetail::class, 'kelompok_id', 'kelompok_id');
} }
public function proposalUrl()
{
return $this->belongsTo(ProposalUrl::class, 'proposal_id', 'proposal_id');
}
} }
...@@ -22,7 +22,7 @@ class ProposalLuaran extends Model ...@@ -22,7 +22,7 @@ class ProposalLuaran extends Model
'proposal_id', 'proposal_id',
'judul', 'judul',
'jenis_luaran', 'jenis_luaran',
'ketegori_luaran', 'kategori_luaran',
'keterangan_luaran', 'keterangan_luaran',
'file_luaran', 'file_luaran',
'created_user', 'created_user',
......
@extends('layouts.master') @extends('layouts.master')
@section('title') @section('title', 'Dashboard')
Dashboard
@endsection
@section('header') @section('header')
<div class="page-title"> <div class="page-title">
...@@ -11,8 +9,8 @@ ...@@ -11,8 +9,8 @@
@endsection @endsection
@section('contents') @section('contents')
<!-- start page title --> <!-- start page title -->
<div class="page-title-box"> <div class="page-title-box">
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-md-8"> <div class="col-md-8">
<h6 class="page-title">{!! $title !!}</h6> <h6 class="page-title">{!! $title !!}</h6>
...@@ -28,11 +26,10 @@ ...@@ -28,11 +26,10 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- end page title -->
</div> <div class="row">
<!-- end page title -->
<div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
...@@ -43,120 +40,231 @@ ...@@ -43,120 +40,231 @@
<th>No</th> <th>No</th>
<th>Jenis</th> <th>Jenis</th>
<th>Judul</th> <th>Judul</th>
<th>Keterangan</th>
<th>File</th> <th>File</th>
<th>Aksi</th> <th>Aksi</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@if ($proposal->rLuaran->count()) {{-- @if ($proposal->rLuaran->count()) --}}
@foreach ($proposal->rLuaran as $item) @foreach ($proposal->rLuaran as $item)
@php $token = Str::random(30); @endphp @php $token = Str::random(30); @endphp
<tr id="row-{{ $token }}"> <tr id="row-{{ $token }}" align="center" valign="middle">
<td>{{ $loop->iteration }}</td> <td>{{ $loop->iteration }}</td>
<td>{{ $item->jenis_luaran }}</td> <td>{{ $item->jenis_luaran }}</td>
<td>{{ $item->judul }}</td> <td>{{ $item->judul }}</td>
<td>{{ $item->keterangan_luaran }}</td>
<td><a href="https://statik.unesa.ac.id/simpmw/luaran/{{ $item->jenis_luaran }}/{{ $item->file_luaran }}" target="_blank" title="Logbook" class="btn btn-info btn-sm waves-effect waves-light"> <i class="fas fa-search"></i> Lihat</a></td> <td><a href="https://statik.unesa.ac.id/simpmw/luaran/{{ $item->jenis_luaran }}/{{ $item->file_luaran }}" target="_blank" title="Logbook" class="btn btn-info btn-sm waves-effect waves-light"> <i class="fas fa-search"></i> Lihat</a></td>
<td> <td>
<a onclick="hapus('{{ encrypt($item->id) }}', 'row-{{ $token }}')" class="btn btn-danger btn-sm">Hapus</a> <a class="btn btn-warning btn-sm fas fa-pencil-alt"> Edit</a>
<a onclick="hapus('{{ encrypt($item->id) }}', 'row-{{ $token }}')" class="btn btn-danger btn-sm fas fa-trash-alt"> Hapus</a>
</td> </td>
</tr> </tr>
@endforeach @endforeach
@else {{-- @else
<tr> <tr>
<td colspan="5" style="text-align: center; font-style: italic;">Tidak ada data yang dapat diambil.</td> <td colspan="6" style="text-align: center; font-style: italic;">Tidak ada data yang dapat diambil.</td>
</tr> </tr>
@endif @endif --}}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> <!-- end col --> </div> <!-- end col -->
</div> <!-- end row --> </div> <!-- end row -->
<div id="tmbhKel" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div id="tmbhKel" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="{{ route('mahasiswa.luaran.store') }}" method="POST" enctype="multipart/form-data"> <form action="{{ route('mahasiswa.luaran.store') }}" method="POST" enctype="multipart/form-data">
@csrf @csrf
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Tambah Luaran</h5> <h5 class="modal-title" id="myModalLabel">Tambah Laporan Magang / Luaran</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<input class="form-control" type="hidden" name="proposal_id" id="proposal_id" value="{{ $proposal->proposal_id }}"> <input class="form-control" type="hidden" name="proposal_id" id="proposal_id" value="{{ $proposal->proposal_id }}">
<div class="col-12"> <div class="col-12">
<h5 class="font-size-16">Jenis Luaran : </h5> <h5 class="font-size-16">Jenis Laporan/Luaran : </h5>
<p><select class="form-select" aria-label="Default select example" name="jenis_luaran"> <p><select class="form-select" aria-label="Default select example" name="jenis_luaran" id="jenis_luaran_select" required>
<option value="">--Pilih--</option>
<option value="Laporan Magang">Laporan Magang</option>
<option value="Buku">Buku</option> <option value="Buku">Buku</option>
<option value="Jurnal">Jurnal</option> <option value="Jurnal">Jurnal</option>
<option value="Video">Video</option> <option value="Video">Video</option>
<option value="Produk">Produk</option> <option value="Produk">Produk</option>
<option value="Media">Publikasi Media</option> <option value="Media">Publikasi Media</option>
<option value="Lainnya">Lainnya</option>
</select></p> </select></p>
</div> </div>
<div class="col-12" id="lainnya_form" style="display: none;">
<h5 class="font-size-16">Jenis Laporan/Luaran Lainnya : </h5>
<p>
<input class="form-control" type="text" name="jenis_luaran_lainnya" id="jenis_luaran_lainnya" value="{{ old('jenis_luaran_lainnya') }}">
</p>
</div>
<div class="col-12"> <div class="col-12">
<h5 class="font-size-16">Judul : </h5> <h5 class="font-size-16">Judul : </h5>
<p> <p>
<input class="form-control" type="text" name="judul" id="judul"> <input class="form-control" type="text" name="judul" id="judul" value="{{ old('judul') }}" required>
</p> </p>
</div>
<div class="col-12"> <div class="col-12">
<h5 class="font-size-16">Upload File : </h5> <h5 class="font-size-16">Upload File : </h5>
<div class="row">
<div class="col-8">
<p> <p>
<input type="file" name="file" class="form-control" id="input-file"> <input type="file" name="file" class="form-control" id="input-file">
@if ($errors->has('file')) <span class="text-danger">{{ $errors->first('file') }}</span> @endif @if ($errors->has('file')) <span class="text-danger">{{ $errors->first('file') }}</span> @endif
</p> </p>
</div>
<div class="col-4">
<button type="button" class="btn btn-warning form-control" id="btnPreview">Preview</button>
</div>
</div>
</div>
<div class="col-12"> <div class="col-12">
<h5 class="font-size-16">Keterangan : </h5> <h5 class="font-size-16">Keterangan : </h5>
<p> <p>
<textarea id="textarea" class="form-control" maxlength="225" rows="3" name="keterangan_luaran" ></textarea> <textarea id="textarea" class="form-control" maxlength="225" rows="3" name="keterangan_luaran" required></textarea>
</p> </p>
</div> </div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary waves-effect" data-bs-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary waves-effect waves-light">Save changes</button> <button type="submit" class="btn btn-primary waves-effect waves-light">Simpan</button>
</div> </div>
</form> </form>
</div> </div>
<!-- /.modal-content --> <!-- /.modal-content -->
</div> </div>
<!-- /.modal-dialog --> <!-- /.modal-dialog -->
</div>
<!-- Modal Preview -->
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog" aria-labelledby="pdfModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content" style="height: 80vh;">
<div class="modal-header">
<h5 class="modal-title" id="pdfModalLabel">Preview PDF</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">{{-- <span aria-hidden="true">&times;</span> --}}</button>
</div>
<div class="modal-body">
{{-- <iframe id="pdfViewer" width="100%" height="100%" frameborder="0"></iframe> --}}
{{-- <iframe id="view-pdf" width="100%" height="450" frameborder="0" src="{{ $proposal ? 'https://statik.unesa.ac.id/simpkm/proposal/'.$proposal->rPeriode->nama.'/'.$proposal->upload_dokumen : '' }} "></iframe> --}}
<iframe id="view-pdf" width="100%" height="100%"></iframe>
</div> </div>
</div>
</div>
</div>
@endsection @endsection
@section('js') @section('js')
{{-- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script> --}}
<script> <script>
function hapus(id, rowId){ $(document).ready(function () {
$('#input-file').on('change', function (e) {
var fileInput = e.target.files[0];
// Periksa apakah ada file yang dipilih
if (!fileInput) {
alert('Silakan pilih file PDF terlebih dahulu.');
return;
}
// Periksa tipe file (harus PDF)
if (fileInput.type !== 'application/pdf') {
alert('File harus berupa PDF.');
// Reset input file
$('#input-file').val('');
return;
}
// Periksa ukuran file (maksimal 5MB)
if (fileInput.size > 5 * 1024 * 1024) {
alert('Ukuran file maksimal adalah 5MB.');
// Reset input file
$('#input-file').val('');
return;
}
});
// Fungsi untuk tombol "Preview"
$('#btnPreview').click(function() {
var fileInput = $('#input-file')[0].files[0];
// Periksa apakah ada file yang dipilih
if (!fileInput) {
alert('Silakan pilih file PDF terlebih dahulu.');
return;
}
// Sembunyikan modal "Tambah Luaran"
$('#tmbhKel').modal('hide');
// Tampilkan pratinjau PDF di dalam modal jika file memenuhi syarat
var url = URL.createObjectURL(fileInput);
$('#view-pdf').attr('src', url);
$('#pdfModal').modal('show');
});
// Event saat modal preview ditutup
$('#pdfModal').on('hidden.bs.modal', function (e) {
// Tampilkan kembali modal "Tambah Luaran"
$('#tmbhKel').modal('show');
// Reset iframe saat modal ditutup
$('#view-pdf').attr('src', '');
});
});
</script>
<script>
function hapus(id, rowId) {
Swal.fire({ Swal.fire({
title: 'Apakah anda yakin untuk menghapus usulan ini?', title: 'Apakah Anda yakin untuk menghapus usulan ini?',
text: "file yang sudah terupload juga terhapus", text: "File yang sudah terupload juga akan terhapus",
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'OK', confirmButtonText: 'OK',
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
var token = '{{ csrf_token() }}'; var token = '{{ csrf_token() }}';
var request = $.ajax({ $.ajax({
url: '{{ route('mahasiswa.luaran.hapus') }}', url: '{{ route('mahasiswa.luaran.hapus') }}',
type: 'POST', type: 'POST',
dataType: 'html', dataType: 'json',
data: {id:id, _token:token}, data: {
success: function(data){ id: id,
_token: token
},
success: function(response) {
if (response.status === 'success') {
Swal.fire({ Swal.fire({
title: 'Data Berhasil Di Hapus', title: 'Data Berhasil Dihapus',
icon: 'success', icon: 'success',
showConfirmButton: false, showConfirmButton: false,
timer: 1500 timer: 1500
}).then(() => {
location.reload(); // Refresh halaman setelah pesan sukses ditampilkan
}); });
} else {
$('#'+rowId).remove(); Swal.fire({
title: 'Gagal',
text: response.message,
icon: 'error',
showConfirmButton: false,
timer: 3500
});
}
}, },
error: function(xhr, status, error){ error: function(xhr, status, error) {
Swal.fire({ Swal.fire({
position: 'top-end', position: 'top-center',
icon: 'error', icon: 'error',
title: xhr.responseText, title: 'Terjadi Kesalahan',
text: xhr.responseText,
showConfirmButton: false, showConfirmButton: false,
timer: 3500 timer: 3500
}); });
...@@ -164,6 +272,52 @@ ...@@ -164,6 +272,52 @@
}); });
} }
}) })
}
document.getElementById('jenis_luaran_select').addEventListener('change', function() {
var select = this;
var lainnyaForm = document.getElementById('lainnya_form');
var lainnyaInput = document.getElementById('jenis_luaran_lainnya');
if (select.value === 'Lainnya') {
lainnyaForm.style.display = 'block';
lainnyaInput.setAttribute('required', 'required');
} else {
lainnyaForm.style.display = 'none';
lainnyaInput.removeAttribute('required');
} }
});
document.getElementById('jenis_luaran_select').addEventListener('focus', function() {
var select = this;
if (select.options[0].value === '') {
select.removeChild(select.options[0]);
}
});
document.addEventListener('DOMContentLoaded', function() {
var table = document.getElementById('datatable');
var thead = table.querySelector('thead');
var tbody = table.querySelector('tbody');
// Menghitung jumlah elemen <th> dalam <thead>
var thCount = thead.querySelectorAll('th').length;
// Periksa apakah tbody kosong
if (!tbody.querySelector('tr')) {
var tr = document.createElement('tr');
var td = document.createElement('td');
// Set colspan sesuai dengan jumlah <th>
td.setAttribute('colspan', thCount);
td.style.textAlign = 'center';
td.style.fontStyle = 'italic';
td.textContent = 'Tidak ada data yang dapat diambil.';
tr.appendChild(td);
tbody.appendChild(tr);
}
});
</script> </script>
@endsection @endsection
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</td> </td>
<td align="center"> <td align="center">
<button data-bs-toggle="modal" data-bs-target="{{ '#lihat'.$item->id }}" class="btn btn-success btn-sm form-control mb-2"><i class="fas fa-search"></i> Hasil Penilaian</button> <button data-bs-toggle="modal" data-bs-target="{{ '#lihat'.$item->id }}" class="btn btn-success btn-sm form-control mb-2"><i class="fas fa-search"></i> Hasil Penilaian</button>
<a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->id.'__proposal__I')) }}" type="button" class="btn btn-danger btn-sm waves-effect waves-light form-control" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Revisi Proposal"><i class="fas fa-file-upload"></i> Revisi</a> <a href="{{ URL::to('mahasiswa/monev-revisi/'.encrypt($item->proposal_id.'__proposal__I')) }}" type="button" class="btn btn-danger btn-sm waves-effect waves-light form-control" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Revisi Proposal"><i class="fas fa-file-upload"></i> Revisi</a>
<div id="{{ 'lihat'.$item->id }}" class="modal fade" tabindex="-1" role="dialog" <div id="{{ 'lihat'.$item->id }}" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="lihatLabel" aria-hidden="true"> aria-labelledby="lihatLabel" aria-hidden="true">
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<div class="mb-0"> <div class="mb-0">
<div> <div>
<button type="submit" class="btn btn-primary waves-effect waves-light me-1"> Submit </button> <button type="submit" class="btn btn-primary waves-effect waves-light me-1"> Submit </button>
<button type="button" onclick="window.location.href='{{ URL::to('/mahasiswa/monev/II') }}'" class="btn btn-secondary waves-effect"> Cancel </button> <button type="button" onclick="window.history.back();" class="btn btn-secondary waves-effect"> Cancel </button>
</div> </div>
</div> </div>
</form> </form>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div class="col-md-8"> <div class="col-md-8">
<h6 class="page-title">{!! $title !!}</h6> <h6 class="page-title">{!! $title !!}</h6>
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class="breadcrumb-item">Monev Internal I</li> <li class="breadcrumb-item">{{ $jenis_monev->nama }}</li>
<li class="breadcrumb-item">{!! $title !!}</li> <li class="breadcrumb-item">{!! $title !!}</li>
</ol> </ol>
</div> </div>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<br> <br>
<div class="table-responsive"> <div class="table-responsive">
<table id="example" class="table table-bordered dt-responsive wrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;"> <table id="example" class="table table-bordered dt-responsive wrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead> <thead align="center" style="vertical-align: middle;">
<tr> <tr>
<th rowspan="2">id</th> <th rowspan="2">id</th>
<th rowspan="2">Kode Kelompok</th> <th rowspan="2">Kode Kelompok</th>
......
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