602 lines
23 KiB
PHP
602 lines
23 KiB
PHP
|
<script>
|
||
|
var routeTable = "{{$table ?? ''}}";
|
||
|
routeTable = routeTable.replace(/amp;/g,'');
|
||
|
var validaton;
|
||
|
|
||
|
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', width: '150px'},
|
||
|
{data: 'lvlurgent', name: 'lvlurgent'},
|
||
|
{data: 'created_at', name: 'created_at', width: '150px'},
|
||
|
{data: 'implementor', name: 'implementor', class: 'text-center'},
|
||
|
{data: 'date_deadline', name: 'date_deadline', width: '150px', class: 'text-center'},
|
||
|
{data: 'action', name: 'action'},
|
||
|
];
|
||
|
|
||
|
var columStyle =
|
||
|
[
|
||
|
{
|
||
|
"targets": 2,
|
||
|
'width': '125px',
|
||
|
},
|
||
|
{
|
||
|
// "orderable": false,
|
||
|
"targets": -6,
|
||
|
'width': '200px',
|
||
|
},
|
||
|
{
|
||
|
// "orderable": false,
|
||
|
"targets": -4,
|
||
|
'width': '200px',
|
||
|
},
|
||
|
{
|
||
|
// "orderable": false,
|
||
|
"targets": -2,
|
||
|
'width': '200px',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
var table = znGetTableScrolling(routeTable,colum,columStyle,'indexTable');
|
||
|
// location.reload()
|
||
|
|
||
|
|
||
|
function cetakExcel(pathName) {
|
||
|
var query = {
|
||
|
type: 'cetakExcel',
|
||
|
path: pathName,
|
||
|
}
|
||
|
|
||
|
var url = "{{URL::to('cetakDok')}}?" + $.param(query);
|
||
|
window.open(url);
|
||
|
}
|
||
|
|
||
|
// function cetakLaporan() {
|
||
|
// var query = {
|
||
|
// type: 'cetakLaporan',
|
||
|
// percent: percent,
|
||
|
// }
|
||
|
// var url = "{{URL::to('cetakDok')}}?" + $.param(query);
|
||
|
// window.open(url);
|
||
|
// }
|
||
|
|
||
|
// $('#indexTable').DataTable()
|
||
|
|
||
|
function changeColorTable(event, tableId, colorHex) {
|
||
|
// $('.cardLaporan').css('background-color', colorHex)
|
||
|
loadContent('laporanProject?type='+colorHex, this, event)
|
||
|
}
|
||
|
|
||
|
function batalTask(id) {
|
||
|
popConfirm("Konfirmasi Proses",
|
||
|
`<div class="mt-2">Yakin Akan Membatalkan Task Ini ?</div>`, function () {
|
||
|
let formData = new FormData();
|
||
|
formData.append('id', id)
|
||
|
znLoadingPage()
|
||
|
doPost(base_url+'projects/act_any/batal_css_task', formData, function (msg, data) {
|
||
|
znLoadingPageEnd()
|
||
|
if (data == null){
|
||
|
znNotif("danger", msg);
|
||
|
}else {
|
||
|
if(data.rc == 0){
|
||
|
znNotif('success','Berhasil Membatalkan Data');
|
||
|
table.ajax.url(routeTable).load();
|
||
|
}else{
|
||
|
znNotif("danger", data.rm);
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function dokumen(id, task_code, task_name) {
|
||
|
znLoadingPage();
|
||
|
var formData = new FormData();
|
||
|
doPost(base_url + 'get_dokumen?type=2&id='+id, formData, function(msg, res) {
|
||
|
znLoadingPageEnd()
|
||
|
if(res.data) {
|
||
|
console.log(res)
|
||
|
$('#page_dokumen').html('')
|
||
|
$('#_task_name').html('')
|
||
|
$('#_task_code').html('')
|
||
|
$('#_task_note').html('')
|
||
|
$('#_crtName').html('')
|
||
|
$('#_approveName').html('')
|
||
|
|
||
|
var crtName = (res.data.crtName == null) ? '-' : res.data.crtName.full_name
|
||
|
var approveName = (res.data.approveName == null) ? '-' : res.data.approveName.full_name
|
||
|
var notesImp = (res.data.task.notes_imp == null) ? '-' : res.data.task.notes_imp
|
||
|
|
||
|
$('#_task_name').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Task Name</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${res.data.task.task_name}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
|
||
|
$('#_task_code').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Task Code</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${res.data.task.task_code}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
|
||
|
$('#_task_note').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Task Note</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${res.data.task.task_note}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
|
||
|
$('#_crtName').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Created Name</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${crtName}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
|
||
|
$('#_approveName').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Approval Name</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${approveName}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
|
||
|
$('#page_dokumen').append(`
|
||
|
<div class="col-md-12">
|
||
|
<div class="form-group">
|
||
|
<label>Notes Implementor</label>
|
||
|
<h6 style="font-size: 12px;text-align: justify;line-height: 20px;">${notesImp}</h6>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
$.each(res.data.dokumen, function(k,v) {
|
||
|
// var url = v.url_doc;
|
||
|
// url = base_url + url.substr(1);
|
||
|
|
||
|
var url = v.space_url_doc;
|
||
|
$('#page_dokumen').append(`
|
||
|
<div class="col-md-4">
|
||
|
<div class="form-group">
|
||
|
<label>Dokumen ${(k+1)}</label>
|
||
|
<p><a id="dokumen" href="${url}" 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 minDay(date = new Date()) {
|
||
|
date.setDate(date.getDate() - 30);
|
||
|
|
||
|
return date;
|
||
|
}
|
||
|
|
||
|
var startDate = []
|
||
|
var dateVal = []
|
||
|
|
||
|
function backDate(id, date, monthDate) {
|
||
|
let datex = new Date(monthDate)
|
||
|
let resultDate = minDay(datex);
|
||
|
znLoadingPage()
|
||
|
showDatePicker(resultDate, date)
|
||
|
|
||
|
$('#get_id_date').val(id)
|
||
|
$('#back_date').val(date)
|
||
|
znModal('formBackDate');
|
||
|
}
|
||
|
|
||
|
function showDatePicker(resultDate, date) {
|
||
|
var dateToday = new Date();
|
||
|
$('.backDate').datepicker({
|
||
|
rtl: KTUtil.isRTL(),
|
||
|
orientation: "bottom left",
|
||
|
todayHighlight: false,
|
||
|
format: 'dd-mm-yyyy',
|
||
|
autoclose: true,
|
||
|
}).datepicker("setDate", date).datepicker('setStartDate', resultDate);
|
||
|
znLoadingPageEnd()
|
||
|
}
|
||
|
|
||
|
function storeBackDate() {
|
||
|
var id = $('#get_id_date').val()
|
||
|
var date = $('#back_date').val()
|
||
|
|
||
|
let formData = new FormData();
|
||
|
formData.append('id', id)
|
||
|
formData.append('date', date)
|
||
|
znLoadingPage()
|
||
|
doPost(base_url+'projects/back_date', formData, function (msg, data) {
|
||
|
console.log(data)
|
||
|
znLoadingPageEnd()
|
||
|
if (data == null){
|
||
|
znNotif("danger", msg);
|
||
|
}else {
|
||
|
if(data.rc == 0){
|
||
|
$('#formBackDate').modal('hide')
|
||
|
znNotif('success','Berhasil Ubah Tanggal');
|
||
|
table.ajax.url(routeTable).load();
|
||
|
}else{
|
||
|
znNotif("danger", data.rm);
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function dokumenSpvIt(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;
|
||
|
// url = base_url + url.substr(1);
|
||
|
|
||
|
var url = v.space_url_doc;
|
||
|
$('#page_dokumen').append(`
|
||
|
<div class="col-md-4">
|
||
|
<div class="form-group">
|
||
|
<label>Dokumen ${(k+1)}</label>
|
||
|
<p><a id="dokumen" href="${url}" 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 approveTaskSpvIt(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 rejectTaskSpvIt(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);
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
$(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 prosesTaskHd(id, task_code, task_name, status_id, critical_level_id, notes_imp, date_deadline, task_note) {
|
||
|
console.log({id, task_code, task_name, status_id, critical_level_id, notes_imp, date_deadline, task_note})
|
||
|
znModal('mFormProsesTask');
|
||
|
// $('#mFormProsesTask').modal('show');
|
||
|
$('#form_helpdesk')[0].reset();
|
||
|
$('.custom-file-label').html('')
|
||
|
var taskNote = task_note.replace(/(?:\\[rn])+/g, "\n");
|
||
|
$('#task_code').html(task_code)
|
||
|
$('#task_name').html(task_name)
|
||
|
$('#task_note').html(taskNote)
|
||
|
$('#date_deadline').val(znFormatDateClear(date_deadline))
|
||
|
$('#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);
|
||
|
$('#notes_imp').val(notes_imp)
|
||
|
}
|
||
|
|
||
|
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 dokumenHd(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;
|
||
|
// url = base_url + url.substr(1);
|
||
|
|
||
|
var url = v.space_url_doc;
|
||
|
$('#page_dokumen').append(`
|
||
|
<div class="col-md-4">
|
||
|
<div class="form-group">
|
||
|
<label>Dokumen ${(k+1)}</label>
|
||
|
<p><a id="dokumen" href="${url}" 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_approvalHd(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');
|
||
|
}
|
||
|
|
||
|
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 approveTaskSpvHd(id) {
|
||
|
$('#form_approve_helpdesk')[0].reset();
|
||
|
// $('.custom-file-label').html('')
|
||
|
$('#get_id').val(id)
|
||
|
$('#type_approve').val(1)
|
||
|
znModal('mFormApproveProsesTask');
|
||
|
}
|
||
|
|
||
|
function rejectTaskSpvHd(id) {
|
||
|
$('#form_approve_helpdesk')[0].reset();
|
||
|
// $('.custom-file-label').html('')
|
||
|
$('#get_id').val(id)
|
||
|
$('#type_approve').val(2)
|
||
|
znModal('mFormApproveProsesTask');
|
||
|
}
|
||
|
|
||
|
function dokumenSpvHd(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;
|
||
|
// url = base_url + url.substr(1);
|
||
|
|
||
|
var url = v.space_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="${url}" 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="${url}" 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>
|