chess/resources/views/content/projects/action_approve_det_helpdesk.blade.php

157 lines
6.5 KiB
PHP
Raw Normal View History

2024-08-29 03:56:32 +00:00
<script>
var routeTable = "{{$table ?? ''}}";
routeTable = routeTable.replace(/amp;/g,'');
var validation;
var colum = [
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'full_name', name: 'full_name'},
{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');
function approveCssTask() {
if($('#notes_approval').val()) {
if($('#type_approve').val()==1) {
znLoadingModal('mFormApproveProsesTask')
var formData = new FormData();
formData.append('id', $('#get_id').val())
formData.append('note_approval', $('#notes_approval').val())
doPost(base_url+'projects/act_any/approve_proses_css_task', formData, function (msg, data) {
// znLoadingPageEnd();
znLoadingModalEnd('mFormApproveProsesTask')
if (data == null){
znNotif("danger", msg);
}else {
if(data.rc == 0){
znNotif('success','Berhasil Approve Data');
table.ajax.url(routeTable).load();
$('#mFormApproveProsesTask').modal('hide')
}else{
znNotif("danger", data.rm);
}
}
})
} else {
znLoadingModal('mFormApproveProsesTask')
var formData = new FormData();
formData.append('id', $('#get_id').val())
formData.append('note_approval', $('#notes_approval').val())
doPost(base_url+'projects/act_any/reject_proses_css_task', formData, function (msg, data) {
// znLoadingPageEnd();
znLoadingModalEnd('mFormApproveProsesTask')
if (data == null){
znNotif("danger", msg);
}else {
if(data.rc == 0){
znNotif('success','Berhasil Reject Data');
table.ajax.url(routeTable).load();
$('#mFormApproveProsesTask').modal('hide')
}else{
znNotif("danger", data.rm);
}
}
})
}
} else {
swal.fire('informasi', 'catatan harus diisi', 'info')
}
}
function approveTask(id) {
$('#form_approve_helpdesk')[0].reset();
// $('.custom-file-label').html('')
$('#get_id').val(id)
$('#type_approve').val(1)
znModal('mFormApproveProsesTask');
}
function rejectTask(id) {
$('#form_approve_helpdesk')[0].reset();
// $('.custom-file-label').html('')
$('#get_id').val(id)
$('#type_approve').val(2)
znModal('mFormApproveProsesTask');
}
function dokumen(id, task_code, task_name) {
znLoadingPage();
var formData = new FormData();
doPost(base_url + 'get_dokumen?id='+id, formData, function(msg, res) {
znLoadingPageEnd()
if(res.data) {
$('#page_dokumen').html('')
$('#page_dokumen').append(`
<div class="col-md-12">
<div class="form-group">
<label>Deskripsi From User</label>
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${res.data.task.task_note}</h6>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Notes Implementor</label>
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${res.data.task.notes_imp}</h6>
</div>
</div>
`)
$.each(res.data.dokumen, function(k,v) {
var url = v.url_doc;
if(v.type_doc==1) {
$('#page_dokumen').append(`
<div class="col-md-4">
<div class="form-group">
<label>Dokumen From User</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>
`)
} else {
$('#page_dokumen').append(`
<div class="col-md-4">
<div class="form-group">
<label>Dokumen Implementor</label>
<p><a id="dokumen" href="${base_url + url.substr(1)}" class="btn btn-sm btn-success" 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');
}
})
}
</script>