Add frontend assets and plugin bundles
Add the legacy frontend themes, scripts, and plugin assets required by the main SPOTA interfaces.
This commit is contained in:
247
assets/js/mhs/_penawaran.php
Normal file
247
assets/js/mhs/_penawaran.php
Normal file
@@ -0,0 +1,247 @@
|
||||
<link rel="stylesheet" type="text/css" href="../assets/plugins/select2/select2.css" />
|
||||
<link rel="stylesheet" href="../assets/plugins/DataTables/media/css/DT_bootstrap.css" />
|
||||
<!-- <link rel="stylesheet" href="../assets/plugins/ckeditor/contents.css"> -->
|
||||
<!-- <link href="../assets/plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css"/> -->
|
||||
<link href="../assets/plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
|
||||
<link rel="stylesheet" href="../assets/plugins/gritter/css/jquery.gritter.css">
|
||||
<link rel="stylesheet" href="../assets/plugins/jQuery-Tags-Input/jquery.tagsinput.css">
|
||||
|
||||
<script type="text/javascript" src="../assets/plugins/select2/select2.min.js"></script>
|
||||
<script type="text/javascript" src="../assets/plugins/DataTables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script type="text/javascript" src="../assets/plugins/DataTables/media/js/DT_bootstrap.js"></script>
|
||||
<script src="../assets/plugins/ckeditor/ckeditor.js"></script>
|
||||
<script src="../assets/plugins/ckeditor/adapters/jquery.js"></script>
|
||||
<script src="../assets/plugins/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="../assets/plugins/bootstrap-modal/js/bootstrap-modal.js"></script>
|
||||
<script src="../assets/plugins/bootstrap-modal/js/bootstrap-modalmanager.js"></script>
|
||||
<script src="../assets/plugins/gritter/js/jquery.gritter.min.js"></script>
|
||||
<script src="../assets/plugins/jQuery-Tags-Input/jquery.tagsinput.min.js"></script>
|
||||
|
||||
<script>
|
||||
let listDataPenawaran = [];
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
Main.init();
|
||||
|
||||
$('#list-judul_wrapper .dataTables_filter input').addClass("form-control input-sm").attr("placeholder", "Search");
|
||||
$('#list-judul_wrapper .dataTables_length select').addClass("m-wrap small");
|
||||
$('#list-judul_wrapper .dataTables_length select').select2();
|
||||
|
||||
// $('#kep-draft-praoutline').dataTable({
|
||||
// "iDisplayLength": 10,
|
||||
// "aLengthMenu": [
|
||||
// [10, 15, 20, 50, 100, -1],
|
||||
// [10, 15, 20, 50, 100, "All"] // change per page values here
|
||||
// ],
|
||||
// "bProcessing": true,
|
||||
// "bServerSide": true,
|
||||
// "bSort": false,
|
||||
// "sAjaxSource": "page/praoutline/list.kep.draft.praoutline.php",
|
||||
// "oLanguage": {
|
||||
// "sLengthMenu": "Menampilkan _MENU_ Data per halaman",
|
||||
// "sZeroRecords": "Maaf, Data tidak ada",
|
||||
// "sInfo": "Menampilkan _START_ s/d _END_ dari _TOTAL_ data",
|
||||
// "sInfoEmpty": "Menampilakan 0 s/d 0 dari 0 data",
|
||||
// "sSearch": "",
|
||||
// "sInfoFiltered": "",
|
||||
// "oPaginate": {
|
||||
// "sPrevious": "",
|
||||
// "sNext": ""
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// $('#kep-draft-praoutline_wrapper .dataTables_filter input').addClass("form-control input-sm").attr("placeholder", "Search");
|
||||
// $('#kep-draft-praoutline_wrapper .dataTables_length select').addClass("m-wrap small");
|
||||
// $('#kep-draft-praoutline_wrapper .dataTables_length select').select2();
|
||||
|
||||
refreshTabelPenawaranJudul(true);
|
||||
|
||||
});
|
||||
|
||||
|
||||
function refreshTabelPenawaranJudul(first = false){
|
||||
const status = $('#statusPenawaranJudul').val();
|
||||
const kk = $('#kkPenawaranJudul').val();
|
||||
|
||||
document.getElementById('contentTabel').innerHTML = buatTabelPenawaranJudulSaya(`<tr><td colspan="9" style="text-align:center">Mengambil Data . . .</td></tr>`);
|
||||
|
||||
const url = `API/list.data.judul.php?status=${status}&kk=${kk}`;
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:'GET',
|
||||
dataType:'json',
|
||||
contentType: false,
|
||||
cache: false,
|
||||
processData:false,
|
||||
beforeSend:function(){
|
||||
// $("#loading").show();
|
||||
},
|
||||
success:function(json){
|
||||
const data = json;
|
||||
if(data.length == 0){
|
||||
document.getElementById('contentTabel').innerHTML = buatTabelPenawaranJudulSaya(`<tr><td colspan="9" style="text-align:center">Tidak ada data.</td></tr>`);
|
||||
}else{
|
||||
|
||||
let isiTabel = ``;
|
||||
let no = 1;
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
const d = data[i];
|
||||
listDataPenawaran[d.id] = d;
|
||||
|
||||
let identitasMahasiswa = '-';
|
||||
if(d.nama != null){
|
||||
identitasMahasiswa = `${d.nama} / ${d.nim}`;
|
||||
}
|
||||
|
||||
let sudahDiambil = true;
|
||||
let tglHangus = d.hangus;
|
||||
let ditolak = false;
|
||||
|
||||
if(d.status == null || d.status == 2){
|
||||
sudahDiambil = false;
|
||||
tglHangus = '';
|
||||
|
||||
if(d.status == 2){
|
||||
ditolak = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(d.status == 1){
|
||||
tglHangus = '';
|
||||
}
|
||||
|
||||
let btnVerif = `<a role="menuitem" tabindex="-1" href="?page=penawaran&act=ambil&id=${d.id}" >
|
||||
<button class="btn btn-success">Booking</button>
|
||||
</a>`;
|
||||
let labelStatus = `<label class="btn btn-primary">Belum Diambil</label>`;
|
||||
|
||||
if(sudahDiambil){
|
||||
labelStatus = `<label class="btn btn-success">Sudah Diambil</label>`;
|
||||
btnVerif = `<a role="menuitem" tabindex="-1" href="?page=penawaran&act=lihat&id=${d.id}" >
|
||||
<button class="btn btn-primary">Lihat</button>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
/**
|
||||
if(ditolak){
|
||||
labelStatus = `<label class="btn btn-danger">Ditolak Oleh Dosen</label>`;
|
||||
}
|
||||
*/
|
||||
|
||||
isiTabel += `<tr>
|
||||
<td>${no}</td>
|
||||
<td>${d.judul}</td>
|
||||
<td>${d.deskripsi}</td>
|
||||
<td>${d.kk}</td>
|
||||
<td>${d.dosen}</td>
|
||||
<td>${labelStatus}</td>
|
||||
<td>${identitasMahasiswa}</td>
|
||||
<td>${tglHangus}</td>
|
||||
<td>
|
||||
${btnVerif}
|
||||
</td>
|
||||
</tr>`;
|
||||
no++;
|
||||
}
|
||||
|
||||
document.getElementById('contentTabel').innerHTML = buatTabelPenawaranJudulSaya(isiTabel);
|
||||
$('#tabelData').DataTable({
|
||||
"iDisplayLength": -1,
|
||||
"aLengthMenu": [
|
||||
[10, 15, 20, 50, 100, -1],
|
||||
[10, 15, 20, 50, 100, "All"] // change per page values here
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buatTabelPenawaranJudulSaya(isiTabel){
|
||||
return `
|
||||
<table class="table table-striped table-bordered table-hover table-full-width" id="tabelData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:5%;text-align:center">No.</th>
|
||||
<th style="width:25%;text-align:center">Judul</th>
|
||||
<th style="width:25%;text-align:center">Deskripsi</th>
|
||||
<th style="width:10%;text-align:center">KK</th>
|
||||
<th style="width:10%;text-align:center">Dari Dosen</th>
|
||||
<th style="width:5%;text-align:center">Status</th>
|
||||
<th style="width:10%;text-align:center">Diambil Oleh</th>
|
||||
<th style="width:10%;text-align:center">Hangus Otomatis Pada</th>
|
||||
<th style="width:5%;text-align:center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${isiTabel}
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
}
|
||||
|
||||
$("#ambil_penawaran").validate({
|
||||
errorPlacement:function(error,element){
|
||||
error.appendTo( element.parent("div"));
|
||||
},
|
||||
submitHandler:function(form){
|
||||
if(window.FormData !== undefined) // for HTML5 browsers
|
||||
{
|
||||
var formData = new FormData(document.getElementById("ambil_penawaran"));
|
||||
$.ajax({
|
||||
url:'page/penawaran/act.data-penawaran.php',
|
||||
type:'POST',
|
||||
data:formData,
|
||||
dataType:'json',
|
||||
mimeType:'multipart/form-data',
|
||||
contentType: false,
|
||||
cache: false,
|
||||
processData:false,
|
||||
beforeSend:function(){
|
||||
$("#loading").show();
|
||||
},
|
||||
success:function(json){
|
||||
if(json.result){
|
||||
$("#loading").hide();
|
||||
$.gritter.add({
|
||||
title:'Sukses',
|
||||
time: 1000,
|
||||
text: json.msg,
|
||||
after_close: function(){
|
||||
location.href="?page=penawaran";
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$("#loading").hide();
|
||||
$.gritter.add({
|
||||
title:'Kesalahan',
|
||||
time: 4000,
|
||||
text: json.msg
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}else{ //for olden browsers
|
||||
|
||||
var iframeId = "unique" + (new Date().getTime());
|
||||
var iframe = $('<iframe src="javascript:false;" name="'+iframeId+'" />');
|
||||
iframe.hide();
|
||||
form.attr("target",iframeId);
|
||||
iframe.appendTo("body");
|
||||
iframe.load(function(e){
|
||||
var doc = getDoc(iframe[0]);
|
||||
var docRoot = doc.body ? doc.body : doc.documentElement;
|
||||
var data = docRoot.innerHTML;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user