Commit 1a89dfa2 by Alfiro Pratama

Fix Reload Monev II Anggaran

parent 57a03e77
......@@ -120,7 +120,7 @@
<div id="anggaran" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<form action="{{ route('mahasiswa.monev-anggaran-store') }}" method="POST" enctype="multipart/form-data">
<form id="form-add" action="{{ route('mahasiswa.monev-anggaran-store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Tambah Data Bukti Penggunaan Anggaran</h5>
......@@ -185,13 +185,17 @@
<label for="nota_file" class="col-sm-4 col-form-label">Unggah File Nota/Kwitansi <span style="margin-left: 5px"><i class="mdi mdi-information-outline" data-bs-toggle="tooltip" title="Unggah file dalam bentuk PDF (maks. 5 MB)"></i></span><span style="color: red;"> *</span></label>
<div class="col-sm-6 col-lg-6">
<input type="file" name="nota_file" class="form-control" id="input-file" accept="application/pdf">
{{-- @if ($errors->has('file')) <span class="text-danger"><i>{{ $errors->first('file') }}</i></span> @endif --}}
@if ($errors->has('file')) <span class="text-danger"><i>{{ $errors->first('file') }}</i></span> @endif
{{-- <iframe id="view-pdf" width="80%" height="80%" frameborder="0" src="{{ $proposal ? 'https://statik.unesa.ac.id/simpkm/proposal/'.$proposal->rPeriode->nama.'/'.$proposal->upload_dokumen : '' }} "></iframe> --}}
</div>
<div class="col-sm-2 col-lg-2">
<button type="button" class="form-control btn btn-warning" id="btnPreview">Preview</button>
</div>
</div>
<div id="previewContent" class="mfp-hide">
<h3>Preview File Nota/Kwitansi</h3>
<iframe id="view-pdf" width="80%" height="80%" frameborder="0" src=""></iframe>
</div>
{{-- <div class="col-12">
<h5 class="font-size-16">Keterangan : </h5>
<p>
......@@ -215,9 +219,8 @@
<script>
$(document).ready(function() {
const table = $('#datatable').DataTable({
// Pengaturan tampilan dan kontrol DataTable
autoWidth: false,
order: [[0, 'asc']], // Mengatur pengurutan default berdasarkan kolom pertama
order: [[0, 'asc']],
columnDefs: [
{
targets: [0],
......@@ -235,7 +238,7 @@
text: response.message || 'Data berhasil disimpan',
confirmButtonText: 'OK'
}).then(() => {
table.ajax.reload(); // Reload data table setelah operasi berhasil
location.reload(); // Reload data table setelah operasi berhasil
});
} else {
Swal.fire({
......@@ -249,6 +252,38 @@
});
</script>
<script>
$(document).ready(function () {
const modalAnggaran = $('#anggaran');
$('#btnPreview').on('click', function () {
const fileInput = document.getElementById('input-file');
const file = fileInput.files[0];
if (file && file.type === 'application/pdf') {
const fileURL = URL.createObjectURL(file);
$('#view-pdf').attr('src', fileURL);
modalAnggaran.modal('hide');
$.magnificPopup.open({
items: {
src: '#previewContent',
type: 'inline'
},
callbacks: {
close: function () {
modalAnggaran.modal('show');
}
}
});
} else {
alert('Harap unggah file PDF untuk pratinjau.');
}
});
});
</script>
<script>
// function hapus(id, rowId){
// Swal.fire({
// title: 'Apakah Anda yakin untuk menghapus usulan ini?',
......
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