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

206 lines
7.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: 'name_divisi', name: 'name_divisi'},
{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': '150px',
},
];
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: {
notEmpty: {
message: 'Wajib diisi!'
}
}
},
},
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) {
// console.log(res)
znLoadingPageEnd()
if(res.data) {
$('#page_dokumen').html('')
$('#page_dokumen').append(`
<div class="col-md-12">
<div class="form-group">
<label>Task Notes</label>
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${res.data.task.task_note}</h6>
</div>
</div>
`);
$.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 approveTask(id) {
znLoadingPage()
var formData = new FormData();
formData.append('id', id)
doPost(base_url+'projects/act_any/approve_open_css_task', formData, function (msg, data) {
// znLoadingPageEnd();
znLoadingPageEnd()
if (data == null){
znNotif("danger", msg);
}else {
if(data.rc == 0){
znNotif('success','Berhasil Approve Data');
table.ajax.url(routeTable).load();
}else{
znNotif("danger", data.rm);
}
}
})
}
function rejectTask(id) {
znLoadingPage()
var formData = new FormData();
formData.append('id', id)
doPost(base_url+'projects/act_any/reject_open_css_task', formData, function (msg, data) {
// znLoadingPageEnd();
znLoadingPageEnd()
if (data == null){
znNotif("danger", msg);
}else {
if(data.rc == 0){
znNotif('success','Berhasil Reject Data');
table.ajax.url(routeTable).load();
}else{
znNotif("danger", data.rm);
}
}
})
}
</script>