179 lines
6.8 KiB
PHP
179 lines
6.8 KiB
PHP
|
<script>
|
||
|
var routeTable = "{{$table ?? ''}}";
|
||
|
routeTable = routeTable.replace(/amp;/g,'');
|
||
|
var validation;
|
||
|
|
||
|
var colum = [
|
||
|
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
|
||
|
{data: 'project_name', name: 'project_name'},
|
||
|
{data: 'task_code', name: 'task_code'},
|
||
|
{data: 'task_name', name: 'task_name'},
|
||
|
{data: 'task_note', name: 'task_note'},
|
||
|
{data: 'status', name: 'status'},
|
||
|
{data: 'lvlurgent', name: 'lvlurgent'},
|
||
|
{data: 'created_at', name: 'created_at'},
|
||
|
{data: 'action', name: 'action'},
|
||
|
];
|
||
|
|
||
|
var columStyle =
|
||
|
[
|
||
|
{
|
||
|
"targets": 2,
|
||
|
'width': '125px',
|
||
|
},
|
||
|
{
|
||
|
"targets": -4,
|
||
|
"width": "150px",
|
||
|
},
|
||
|
{
|
||
|
"orderable": false,
|
||
|
"targets": -2,
|
||
|
'width': '200px',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
var table = znGetTableScrolling(routeTable,colum,columStyle,'indexTable');
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
validation = FormValidation.formValidation(
|
||
|
KTUtil.getById('form_helpdesk'),
|
||
|
{
|
||
|
fields: {
|
||
|
notes_imp: {
|
||
|
validators: {
|
||
|
notEmpty: {
|
||
|
message: 'Wajib diisi!'
|
||
|
},
|
||
|
stringLength: {
|
||
|
max: 1000,
|
||
|
min: 1,
|
||
|
message: 'Minimal 1 karakter, Maksimal 1000 karakter'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
status_id: {
|
||
|
validators: {
|
||
|
notEmpty: {
|
||
|
message: 'Wajib diisi!'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
critical_level_id: {
|
||
|
validators: {
|
||
|
notEmpty: {
|
||
|
message: 'Wajib diisi!'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
dok_helpdesk: {
|
||
|
validators: {
|
||
|
callback: {
|
||
|
message: 'Wajib diisi!',
|
||
|
callback: function(input) {
|
||
|
if($('#status_id').val()==5 && input.value=='') {
|
||
|
return {
|
||
|
valid: false,
|
||
|
message: 'Dokumen wajib diisi',
|
||
|
}
|
||
|
} else {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
plugins: {
|
||
|
trigger: new FormValidation.plugins.Trigger(),
|
||
|
bootstrap: new FormValidation.plugins.Bootstrap()
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
})
|
||
|
|
||
|
function prosesTask(id, task_code, task_name, status_id, critical_level_id) {
|
||
|
$('#form_helpdesk')[0].reset();
|
||
|
$('.custom-file-label').html('')
|
||
|
$('#task_code').html(task_code)
|
||
|
$('#task_name').html(task_name)
|
||
|
$('#status_id').val(status_id).trigger('change.select2')
|
||
|
$('#critical_level_id').val(critical_level_id).trigger('change.select2')
|
||
|
$('#get_id').val(id)
|
||
|
validation.resetForm(true);
|
||
|
znModal('mFormProsesTask');
|
||
|
}
|
||
|
|
||
|
function prosesCssTask() {
|
||
|
validation.validate().then(function (status) {
|
||
|
if(status=='Valid') {
|
||
|
let myForm = document.getElementById('form_helpdesk');
|
||
|
let formData = new FormData(myForm);
|
||
|
popConfirm("Konfirmasi Data Task",
|
||
|
`<div class="mt-2">Kirim data ini ke approval ?</div>`,
|
||
|
function() {
|
||
|
znLoadingModal('mFormProsesTask')
|
||
|
doPost(base_url+'projects/act_any/proses_css_task', formData, function (msg, data) {
|
||
|
// znLoadingPageEnd();
|
||
|
znLoadingModalEnd('mFormProsesTask')
|
||
|
|
||
|
if (data == null){
|
||
|
znNotif("danger", msg);
|
||
|
}else {
|
||
|
if(data.rc == 0){
|
||
|
znNotif('success','Berhasil Menyimpan Data');
|
||
|
table.ajax.url(routeTable).load();
|
||
|
$('#mFormProsesTask').modal('hide')
|
||
|
}else{
|
||
|
znNotif("danger", data.rm);
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
});
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function dokumen(id, task_code, task_name) {
|
||
|
znLoadingPage();
|
||
|
var formData = new FormData();
|
||
|
doPost(base_url + 'get_dokumen?type=1&id='+id, formData, function(msg, res) {
|
||
|
znLoadingPageEnd()
|
||
|
if(res.data) {
|
||
|
$('#page_dokumen').html('')
|
||
|
$.each(res.data.dokumen, function(k,v) {
|
||
|
var url = v.url_doc;
|
||
|
$('#page_dokumen').append(`
|
||
|
<div class="col-md-4">
|
||
|
<div class="form-group">
|
||
|
<label>Dokumen ${(k+1)}</label>
|
||
|
<p><a id="dokumen" href="${base_url + url.substr(1)}" class="btn btn-sm btn-info" target="_blank">
|
||
|
<i class="la la-file font-size-h6"></i> Download Dokumen
|
||
|
</a></p>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
})
|
||
|
znModal('mDetDokumen');
|
||
|
} else {
|
||
|
swal.fire('Informasi', 'Data tidak ditemukan', 'info');
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function lihat_catatan_approval(note) {
|
||
|
$('#page_dokumen').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Notes Reject</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${note}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
znModal('mDetDokumen');
|
||
|
}
|
||
|
|
||
|
</script>
|