748 lines
35 KiB
PHP
748 lines
35 KiB
PHP
<script>
|
|
"use strict";
|
|
var validation_sub_task;
|
|
var team_role_id = '{{ $team_role_id }}';
|
|
|
|
// Class definition
|
|
|
|
var KTKanbanBoardDemo = function() {
|
|
var _demo3 = function() {
|
|
var formData = new FormData();
|
|
var member_id = team_role_id == '1' || team_role_id == '2' ? $('#member_id_kb').val():'{{ Auth::user()->id }}';
|
|
formData.append('id', $('#id_project_kb').val())
|
|
formData.append('team_role_id', team_role_id)
|
|
formData.append('member_id', member_id)
|
|
znLoadingPage()
|
|
doPost(base_url + 'projects/get_any/data_kanban_task', formData, function(msg, data) {
|
|
znLoadingPageEnd()
|
|
var kanban = new jKanban({
|
|
element: '#kt_kanban_3',
|
|
gutter: '0',
|
|
widthBoard: '250px',
|
|
click: function(el) {
|
|
var idEl = $(el).data('eid');
|
|
idEl = idEl.replace('_','');
|
|
var formData = new FormData();
|
|
formData.append('id', idEl);
|
|
formData.append('id_project', $('#id_project_kb').val());
|
|
znLoadingPage()
|
|
doPost(base_url + 'projects/get_any/get_data_detail_task', formData, function(msg, data) {
|
|
znLoadingPageEnd()
|
|
var data = data.data;
|
|
$('#id_task_detail').val(idEl)
|
|
$('#phone_number').val(data.task.phone_number)
|
|
$('#btn_create_sub_task').attr('onclick','createSubTask(`'+idEl+'`)')
|
|
$('#task_name').html(data.task.task_name)
|
|
$('#due_date').html(znFormatDate(data.task.due_date))
|
|
if(team_role_id == 1 || team_role_id == 2) {
|
|
$('#btn_reminder').removeClass('d-none');
|
|
} else {
|
|
$('#btn_reminder').addClass('d-none');
|
|
}
|
|
|
|
if(data.task.status_id==3 && (team_role_id==1 || team_role_id==2)) {
|
|
$('#btn_lanjutkan_task_detail').removeClass('d-none');
|
|
} else {
|
|
$('#btn_lanjutkan_task_detail').addClass('d-none');
|
|
}
|
|
$('#status').html(data.task.status)
|
|
$('#critical_level').html(data.task.critical_level)
|
|
if(data.task.url_doc) {
|
|
$('#dokumen').removeClass('d-none')
|
|
$('#dokumen').attr('href', data.task.url_doc)
|
|
} else {
|
|
$('#dokumen').addClass('d-none')
|
|
}
|
|
$('#task_note').html(data.task.task_note)
|
|
$('#sub_task_').html(``)
|
|
$.each(data.subTask, function(k,v) {
|
|
var style = '';
|
|
if(v.status_id == 4) {
|
|
// style = '<div style="position: absolute; background: red; height: 3px; width: 90%; z-index: 9; border-radius: 15px;"></div>';
|
|
style = 'style="text-decoration: line-through"';
|
|
} else if(v.status_id == 3) {
|
|
// style = '<div style="position: absolute; background: lightseagreen; height: 3px; width: 90%; z-index: 9; border-radius: 15px;"></div>';
|
|
style = 'style="text-decoration: line-through"';
|
|
}
|
|
$('#sub_task_').append(`
|
|
<!--begin::Item-->
|
|
<div class="d-flex align-items-center mb-2 row">
|
|
<!--begin::Text-->
|
|
<div class="col-md-8">
|
|
<div class="d-flex flex-column flex-grow-1">
|
|
<a href="#" class="text-dark-75 text-hover-primary font-weight-bold font-size-lg mb-1" ${style}>`+v.subtask_detail+`</a>
|
|
<span class="text-muted font-weight-bold">`+v.status+`</span>
|
|
</div>
|
|
</div>
|
|
<!--end::Text-->
|
|
<!--begin::Dropdown-->
|
|
<div class="col-md-4 text-right">
|
|
<a href="javascript:;" onclick="updateSubTask('`+v.id+`','`+v.subtask_detail+`','`+v.status_id+`','`+idEl+`')" class="btn btn-light-info btn-sm font-size-sm font-weight-bolder text-dark-75 btn-icon" data-toggle="tooltip" title="" data-placement="left" data-original-title="Update Sub Task"><i class="la la-edit"></i></a>
|
|
</div>
|
|
<!--end::Dropdown-->
|
|
</div>
|
|
<!--end::Item-->
|
|
`)
|
|
})
|
|
$('#comment_task').html(``)
|
|
$.each(data.commentTask, function(k,v) {
|
|
var textAlign = 'text-left';
|
|
var alignItem = 'align-items-start';
|
|
var bgChat = 'bg-light-primary';
|
|
if(v.user_crt_id == '{{ Auth::user()->id }}') {
|
|
textAlign = 'align-items-right';
|
|
alignItem = 'align-items-end';
|
|
bgChat = 'bg-light-success';
|
|
}
|
|
$('#comment_task').append(`
|
|
<!--begin::Message In-->
|
|
<div class="d-flex flex-column mb-5 `+alignItem+`">
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-circle symbol-35 mr-3">
|
|
<img alt="Pic" src="`+v.image_url+`" />
|
|
</div>
|
|
<div>
|
|
<a href="#" class="text-dark-75 text-hover-primary font-weight-bold font-size-h6">`+v.full_name+`</a>
|
|
<span class="text-muted font-size-sm">`+znFormatDatetime(v.created_at)+`</span>
|
|
</div>
|
|
</div>
|
|
<div class="mt-2 rounded p-5 `+bgChat+` text-dark-50 font-weight-bold font-size-md `+textAlign+` max-w-400px">`+v.comment_note+`</div>
|
|
</div>
|
|
<!--end::Message In-->
|
|
`);
|
|
})
|
|
znModal('mDetTask')
|
|
$('[data-scroll="true"]').each(function() {
|
|
var el = $(this);
|
|
KTUtil.scrollInit(this, {
|
|
mobileNativeScroll: true,
|
|
handleWindowResize: true,
|
|
rememberPosition: (el.data('remember-position') == 'true' ? true : false),
|
|
height: function() {
|
|
if (KTUtil.isBreakpointDown('lg') && el.data('mobile-height')) {
|
|
return el.data('mobile-height');
|
|
} else {
|
|
return el.data('height');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
},
|
|
dropEl: function(el, target, source, sibling) {
|
|
var sourceId = source.parentElement.getAttribute('data-id');
|
|
var targetId = target.parentElement.getAttribute('data-id');
|
|
var idTask = $(el).data('eid');
|
|
var statusTarget = target.parentElement.getAttribute('data-id');
|
|
statusTarget = statusTarget.replace('_','');
|
|
var bgTask = ['info', 'warning', 'success', 'danger'];
|
|
var idTask = $(el).data('eid');
|
|
var idT = idTask.replace('_','');
|
|
var formData = new FormData();
|
|
formData.append('id', idT)
|
|
formData.append('status_id', statusTarget);
|
|
znLoadingPage()
|
|
doPost(base_url + 'projects/act_any/update_status_task', formData, function(msg, data) {
|
|
znLoadingPageEnd()
|
|
if(data.rc == null) {
|
|
kanban.removeElement(idTask)
|
|
kanban.addElement(sourceId, {
|
|
id: $(el).data('eid'),
|
|
title: el.innerHTML,
|
|
statusid: $(el).data('statusid'),
|
|
class: bgTask[parseInt($(el).data('statusid'))-1]
|
|
},0);
|
|
znNotif('danger','Internal Server Error');
|
|
} else {
|
|
if(data.rc == 0){
|
|
if(statusTarget==3 && (team_role_id==1 || team_role_id==2)) {
|
|
$('#id_task_lanjutkan').val('');
|
|
popConfirm("Lanjutkan", `<div class="mt-2">Apakah Task ini akan diteruskan ke Member lain ?</div>`, function() {
|
|
$('#id_task_lanjutkan').val(idT);
|
|
znModal('mFormLanjutkanTask')
|
|
});
|
|
}
|
|
$(el).attr('data-class', bgTask[parseInt(statusTarget)-1])
|
|
}else{
|
|
kanban.removeElement(idTask)
|
|
kanban.addElement(sourceId, {
|
|
id: $(el).data('eid'),
|
|
title: el.innerHTML,
|
|
statusid: $(el).data('statusid'),
|
|
class: bgTask[parseInt($(el).data('statusid'))-1]
|
|
},0);
|
|
znNotif("danger", data.rm);
|
|
}
|
|
}
|
|
});
|
|
},
|
|
boards: data.data
|
|
});
|
|
});
|
|
}
|
|
|
|
/* var _demo4 = function() {
|
|
var kanban = new jKanban({
|
|
element: '#kt_kanban_4',
|
|
gutter: '0',
|
|
click: function(el) {
|
|
alert(el.innerHTML);
|
|
},
|
|
boards: [{
|
|
'id': '_backlog',
|
|
'title': 'Backlog',
|
|
'class': 'light-dark',
|
|
'item': [{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_24.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">SEO Optimization</span>
|
|
<span class="label label-inline label-light-success font-weight-bold">In progress</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
},
|
|
{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<span class="symbol-label font-size-h4">A.D</span>
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Finance</span>
|
|
<span class="label label-inline label-light-danger font-weight-bold">Pending</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
}
|
|
]
|
|
},
|
|
{
|
|
'id': '_todo',
|
|
'title': 'To Do',
|
|
'class': 'light-danger',
|
|
'item': [{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_16.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Server Setup</span>
|
|
<span class="label label-inline label-light-dark font-weight-bold">Completed</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
},
|
|
{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_15.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Report Generation</span>
|
|
<span class="label label-inline label-light-warning font-weight-bold">Due</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
}
|
|
]
|
|
},
|
|
{
|
|
'id': '_working',
|
|
'title': 'Working',
|
|
'class': 'light-primary',
|
|
'item': [{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_24.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Marketing</span>
|
|
<span class="label label-inline label-light-danger font-weight-bold">Planning</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
},
|
|
{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-light-info mr-3">
|
|
<span class="symbol-label font-size-h4">A.P</span>
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Finance</span>
|
|
<span class="label label-inline label-light-primary font-weight-bold">Done</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
}
|
|
]
|
|
},
|
|
{
|
|
'id': '_done',
|
|
'title': 'Done',
|
|
'class': 'light-success',
|
|
'item': [{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_11.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">SEO Optimization</span>
|
|
<span class="label label-inline label-light-success font-weight-bold">In progress</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
},
|
|
{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_20.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Product Team</span>
|
|
<span class="label label-inline label-light-danger font-weight-bold">In progress</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
}
|
|
]
|
|
},
|
|
{
|
|
'id': '_deploy',
|
|
'title': 'Deploy',
|
|
'class': 'light-primary',
|
|
'item': [{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-light-warning mr-3">
|
|
<span class="symbol-label font-size-h4">D.L</span>
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">SEO Optimization</span>
|
|
<span class="label label-inline label-light-success font-weight-bold">In progress</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
},
|
|
{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-light-danger mr-3">
|
|
<span class="symbol-label font-size-h4">E.K</span>
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Requirement Study</span>
|
|
<span class="label label-inline label-light-warning font-weight-bold">Scheduled</span>
|
|
</div>
|
|
</div>
|
|
`,
|
|
}
|
|
]
|
|
}
|
|
]
|
|
});
|
|
|
|
var toDoButton = document.getElementById('addToDo');
|
|
toDoButton.addEventListener('click', function() {
|
|
kanban.addElement(
|
|
'_todo', {
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-light-primary mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_14.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Requirement Study</span>
|
|
<span class="label label-inline label-light-success font-weight-bold">Scheduled</span>
|
|
</div>
|
|
</div>
|
|
`
|
|
}
|
|
);
|
|
});
|
|
|
|
var addBoardDefault = document.getElementById('addDefault');
|
|
addBoardDefault.addEventListener('click', function() {
|
|
kanban.addBoards(
|
|
[{
|
|
'id': '_default',
|
|
'title': 'New Board',
|
|
'class': 'primary-light',
|
|
'item': [{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_13.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">Payment Modules</span>
|
|
<span class="label label-inline label-light-primary font-weight-bold">In development</span>
|
|
</div>
|
|
</div>
|
|
`},{
|
|
'title': `
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-success mr-3">
|
|
<img alt="Pic" src="assets/media/users/300_12.jpg" />
|
|
</div>
|
|
<div class="d-flex flex-column align-items-start">
|
|
<span class="text-dark-50 font-weight-bold mb-1">New Project</span>
|
|
<span class="label label-inline label-light-danger font-weight-bold">Pending</span>
|
|
</div>
|
|
</div>
|
|
`}
|
|
]
|
|
}]
|
|
)
|
|
});
|
|
|
|
var removeBoard = document.getElementById('removeBoard');
|
|
removeBoard.addEventListener('click', function() {
|
|
kanban.removeBoard('_done');
|
|
});
|
|
} */
|
|
|
|
// Public functions
|
|
return {
|
|
init: function() {
|
|
// _demo1();
|
|
// _demo2();
|
|
_demo3();
|
|
$('.selectpicker').selectpicker()
|
|
$('[data-scroll="true"]').each(function() {
|
|
var el = $(this);
|
|
KTUtil.scrollInit(this, {
|
|
mobileNativeScroll: true,
|
|
handleWindowResize: true,
|
|
rememberPosition: (el.data('remember-position') == 'true' ? true : false),
|
|
height: function() {
|
|
if (KTUtil.isBreakpointDown('lg') && el.data('mobile-height')) {
|
|
return el.data('mobile-height');
|
|
} else {
|
|
return el.data('height');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
// _demo4();
|
|
/* validation_task = FormValidation.formValidation(
|
|
KTUtil.getById('form_task'),
|
|
{
|
|
fields: {
|
|
task_name: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
task_code: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
start_date: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
due_date: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
status_id: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
critical_level_id: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
plugins: {
|
|
trigger: new FormValidation.plugins.Trigger(),
|
|
bootstrap: new FormValidation.plugins.Bootstrap()
|
|
}
|
|
}
|
|
); */
|
|
}
|
|
};
|
|
}();
|
|
|
|
jQuery(document).ready(function() {
|
|
KTKanbanBoardDemo.init();
|
|
validation_sub_task = FormValidation.formValidation(
|
|
KTUtil.getById('form_sub_task'),
|
|
{
|
|
fields: {
|
|
subtask_detail: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
status_id: {
|
|
validators: {
|
|
notEmpty: {
|
|
message: 'Wajib diisi!'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
plugins: {
|
|
trigger: new FormValidation.plugins.Trigger(),
|
|
bootstrap: new FormValidation.plugins.Bootstrap()
|
|
}
|
|
}
|
|
);
|
|
});
|
|
|
|
function reminder(id, phone_number) {
|
|
popConfirm("Konfirmasi",
|
|
`<div class="mt-2">Kirim Reminder Task ?</div>`,
|
|
function() {
|
|
var formData = new FormData();
|
|
formData.append('id', id)
|
|
formData.append('phone_number', phone_number)
|
|
formData.append('project_name', $('#project_name_task').val())
|
|
znLoadingModal('mDetTask')
|
|
doPost(base_url+'projects/act_any/store_reminder', formData, function (msg, data) {
|
|
// znLoadingPageEnd();
|
|
znLoadingModalEnd('mDetTask')
|
|
if (data == null){
|
|
znNotif("danger", msg);
|
|
}else {
|
|
if(data.rc == 0){
|
|
znNotif('success','Berhasil Kirim Reminder');
|
|
$('#mDetTask').modal('hide')
|
|
}else{
|
|
znNotif("danger", data.rm);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
function lanjutkanTaskDetail(id) {
|
|
$('#id_task_lanjutkan').val('')
|
|
$('#id_task_lanjutkan').val(id)
|
|
znModal('mFormLanjutkanTask');
|
|
}
|
|
|
|
function storeLanjutkanTask() {
|
|
var myForm = document.getElementById('form_lanjutkan_task');
|
|
var formData = new FormData(myForm);
|
|
popConfirm("Konfirmasi",
|
|
`<div class="mt-2">Yakin Akan Lanjutkan Data Task Ini ?</div>`,
|
|
function() {
|
|
znLoadingModal('mFormLanjutkanTask')
|
|
doPost(base_url+'projects/act_any/store_lanjutkan_task', formData, function (msg, data) {
|
|
// znLoadingPageEnd();
|
|
znLoadingModalEnd('mFormLanjutkanTask')
|
|
if (data == null){
|
|
znNotif("danger", msg);
|
|
}else {
|
|
if(data.rc == 0){
|
|
znNotif('success','Berhasil Menyimpan Data');
|
|
$('#mDetTask').modal('hide')
|
|
$('#mFormLanjutkanTask').modal('hide')
|
|
}else{
|
|
znNotif("danger", data.rm);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
function createNewTask() {
|
|
var member_id = $('#member_id_kb').val();
|
|
var id_project = $('#id_project_kb').val();
|
|
if(member_id) {
|
|
tambahTask(id_project, member_id)
|
|
} else {
|
|
znNotif('warning', 'pilih member terlebih dahulu')
|
|
}
|
|
}
|
|
|
|
function changeKaban() {
|
|
$('#kt_kanban_3').html(``)
|
|
KTKanbanBoardDemo.init();
|
|
}
|
|
|
|
function createSubTask(id) {
|
|
var form = document.getElementById('form_sub_task');
|
|
form.reset();
|
|
$('#get_id_sub_task').val('')
|
|
$('#task_id').val(id)
|
|
$('#status_id_st').val('').trigger('change.select2')
|
|
znModal('mFormSubTask')
|
|
}
|
|
|
|
function updateSubTask(idSubT, subDet, status, idTask) {
|
|
var form = document.getElementById('form_sub_task');
|
|
form.reset();
|
|
$('#task_id').val(idTask)
|
|
$('#subtask_detail').val(subDet)
|
|
$('#get_id_sub_task').val(idSubT)
|
|
$('#status_id_st').val(status).trigger('change.select2')
|
|
znModal('mFormSubTask')
|
|
}
|
|
|
|
function storeSubTask() {
|
|
validation_sub_task.validate().then(function (status) {
|
|
if(status=='Valid') {
|
|
var task_id = $('#task_id').val();
|
|
var myForm = document.getElementById('form_sub_task');
|
|
var formData = new FormData(myForm);
|
|
popConfirm("Konfirmasi Data Sub Task",
|
|
`<div class="mt-2">Yakin Akan Menyimpan Data Task Ini ?</div>`,
|
|
function() {
|
|
znLoadingModal('mFormSubTask')
|
|
doPost(base_url+'projects/act_any/store_data_sub_task', formData, function (msg, data) {
|
|
// znLoadingPageEnd();
|
|
znLoadingModalEnd('mFormSubTask')
|
|
if (data == null){
|
|
znNotif("danger", msg);
|
|
}else {
|
|
if(data.rc == 0){
|
|
znNotif('success','Berhasil Menyimpan Data');
|
|
getSubTask(task_id)
|
|
$('#mFormSubTask').modal('hide')
|
|
}else{
|
|
znNotif("danger", data.rm);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
})
|
|
}
|
|
|
|
function getSubTask(id) {
|
|
znLoadingModal('mDetTask')
|
|
var formData = new FormData();
|
|
formData.append('id', id);
|
|
doPost(base_url + 'projects/get_any/data_sub_task', formData, function(msg, data) {
|
|
znLoadingModalEnd('mDetTask')
|
|
$('#sub_task_').html(``);
|
|
$.each(data.data, function(k,v) {
|
|
var style = '';
|
|
if(v.status_id == 4) {
|
|
// style = '<div style="position: absolute; background: red; height: 3px; width: 90%; z-index: 9; border-radius: 15px;"></div>';
|
|
style = 'style="text-decoration: line-through"';
|
|
} else if(v.status_id == 3) {
|
|
// style = '<div style="position: absolute; background: lightseagreen; height: 3px; width: 90%; z-index: 9; border-radius: 15px;"></div>';
|
|
style = 'style="text-decoration: line-through"';
|
|
}
|
|
$('#sub_task_').append(`
|
|
<!--begin::Item-->
|
|
<div class="d-flex align-items-center mb-2 row">
|
|
<!--begin::Text-->
|
|
<div class="col-md-8">
|
|
<div class="d-flex flex-column flex-grow-1">
|
|
<a href="#" class="text-dark-75 text-hover-primary font-weight-bold font-size-md mb-1" ${style}>`+v.subtask_detail+`</a>
|
|
<span class="text-muted font-weight-bold">`+v.status+`</span>
|
|
</div>
|
|
</div>
|
|
<!--end::Text-->
|
|
<!--begin::Dropdown-->
|
|
<div class="col-md-4 text-right">
|
|
<a href="javascript:;" onclick="updateSubTask('`+v.id+`','`+v.subtask_detail+`','`+v.status_id+`','`+id+`')" class="btn btn-light-info btn-sm font-size-sm font-weight-bolder text-dark-75 btn-icon" data-toggle="tooltip" title="" data-placement="left" data-original-title="Update Sub Task"><i class="la la-edit"></i></a>
|
|
</div>
|
|
<!--end::Dropdown-->
|
|
</div>
|
|
<!--end::Item-->
|
|
`)
|
|
})
|
|
})
|
|
}
|
|
|
|
function storeCommentTask(id_project, id_task) {
|
|
var formData = new FormData();
|
|
formData.append('id_project', id_project)
|
|
formData.append('id_task', id_task)
|
|
formData.append('comment_task_note', $('#comment_task_note').val())
|
|
popConfirm("Konfirmasi Comment Note",
|
|
`<div class="mt-2">Yakin Akan Menyimpan Data Comment Ini ?</div>`,
|
|
function() {
|
|
znLoadingModal('mDetTask')
|
|
doPost(base_url+'projects/act_any/store_data_comment_task', formData, function (msg, data) {
|
|
// znLoadingPageEnd();
|
|
znLoadingModalEnd('mDetTask')
|
|
if (data == null){
|
|
znNotif("danger", msg);
|
|
}else {
|
|
if(data.rc == 0){
|
|
znNotif('success','Berhasil Menyimpan Data');
|
|
$('#comment_task_note').val('');
|
|
getCommentTask(id_project, id_task)
|
|
}else{
|
|
znNotif("danger", data.rm);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
function getCommentTask(id_project, task_id) {
|
|
znLoadingModal('mDetTask')
|
|
var formData = new FormData();
|
|
formData.append('id_project', id_project);
|
|
formData.append('task_id', task_id);
|
|
doPost(base_url + 'projects/get_any/data_comment_task', formData, function(msg, data) {
|
|
console.log(data)
|
|
znLoadingModalEnd('mDetTask')
|
|
$('#comment_task').html(``)
|
|
$.each(data.data, function(k,v) {
|
|
var textAlign = 'text-left';
|
|
var alignItem = 'align-items-start';
|
|
var bgChat = 'bg-light-primary';
|
|
if(v.user_crt_id == '{{ Auth::user()->id }}') {
|
|
textAlign = 'align-items-right';
|
|
alignItem = 'align-items-end';
|
|
bgChat = 'bg-light-success';
|
|
}
|
|
$('#comment_task').append(`
|
|
<!--begin::Message In-->
|
|
<div class="d-flex flex-column mb-5 `+alignItem+`">
|
|
<div class="d-flex align-items-center">
|
|
<div class="symbol symbol-circle symbol-35 mr-3">
|
|
<img alt="Pic" src="`+v.image_url+`" />
|
|
</div>
|
|
<div>
|
|
<a href="#" class="text-dark-75 text-hover-primary font-weight-bold font-size-h6">`+v.full_name+`</a>
|
|
<br>
|
|
<span class="text-muted font-size-sm">`+znFormatDatetime(v.created_at)+`</span>
|
|
</div>
|
|
</div>
|
|
<div class="mt-2 rounded p-5 `+bgChat+` text-dark-50 font-weight-bold font-size-md `+textAlign+` max-w-400px">`+v.comment_note+`</div>
|
|
</div>
|
|
<!--end::Message In-->
|
|
`);
|
|
})
|
|
})
|
|
}
|
|
</script> |