|
|
@ -31,12 +31,14 @@ $(document).ready(function () { |
|
|
|
"columns": [ |
|
|
|
"columns": [ |
|
|
|
{ data: 'user_name', name: 'user_name' }, |
|
|
|
{ data: 'user_name', name: 'user_name' }, |
|
|
|
{ data: 'role_name', name: 'role_name' }, |
|
|
|
{ data: 'role_name', name: 'role_name' }, |
|
|
|
{ data: 'start_date', name: 'start_date', render: function (data, type) { |
|
|
|
{ |
|
|
|
return data ? formatDate(data) : '-' |
|
|
|
data: 'start_date', name: 'start_date', render: function (data, type) { |
|
|
|
|
|
|
|
return data ? formatDate(data) : '-' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ data: 'end_date', name: 'end_date', render: function (data, type) { |
|
|
|
{ |
|
|
|
return data ? formatDate(data) : '-' |
|
|
|
data: 'end_date', name: 'end_date', render: function (data, type) { |
|
|
|
|
|
|
|
return data ? formatDate(data) : '-' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
@ -78,6 +80,8 @@ $(document).ready(function () { |
|
|
|
$('#modal-hr').on('show.bs.modal', function (event) { |
|
|
|
$('#modal-hr').on('show.bs.modal', function (event) { |
|
|
|
$('#modal-hr-title').html("Human Resource " + activityName); |
|
|
|
$('#modal-hr-title').html("Human Resource " + activityName); |
|
|
|
$('#modal-hr-sub-title').html(`<p style="font-size: 12px; color: #747474">Plan Date ${moment(activityEarlyStart).format('MM-DD-YYYY')} - ${moment(activityEarlyFinish).format('MM-DD-YYYY')}</p>`); |
|
|
|
$('#modal-hr-sub-title').html(`<p style="font-size: 12px; color: #747474">Plan Date ${moment(activityEarlyStart).format('MM-DD-YYYY')} - ${moment(activityEarlyFinish).format('MM-DD-YYYY')}</p>`); |
|
|
|
|
|
|
|
$("#hr-start-date").val(moment(activityEarlyStart).format('YYYY-MM-DD')); |
|
|
|
|
|
|
|
$("#hr-end-date").val(moment(activityEarlyFinish).format('YYYY-MM-DD')); |
|
|
|
$('#modal-hr-time-startDate').html("Minimum from " + moment(activityEarlyStart).format('MM-DD-YYYY')); |
|
|
|
$('#modal-hr-time-startDate').html("Minimum from " + moment(activityEarlyStart).format('MM-DD-YYYY')); |
|
|
|
$('#modal-hr-time-endDate').html("Maximum from " + moment(activityEarlyFinish).format('MM-DD-YYYY')); |
|
|
|
$('#modal-hr-time-endDate').html("Maximum from " + moment(activityEarlyFinish).format('MM-DD-YYYY')); |
|
|
|
tableHr.draw(); |
|
|
|
tableHr.draw(); |
|
|
@ -153,7 +157,6 @@ $(document).ready(function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#select-hr').on('select2:select', function (e) { |
|
|
|
$('#select-hr').on('select2:select', function (e) { |
|
|
|
console.log('select event', e.params.data); |
|
|
|
|
|
|
|
let param_data = e.params.data; |
|
|
|
let param_data = e.params.data; |
|
|
|
if (param_data && param_data.proyek_role) { |
|
|
|
if (param_data && param_data.proyek_role) { |
|
|
|
let proyek_role = param_data.proyek_role |
|
|
|
let proyek_role = param_data.proyek_role |
|
|
@ -162,19 +165,23 @@ $(document).ready(function () { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#hr-start-date").on('change', (e) => { |
|
|
|
$("#hr-start-date").on('input', (e) => { |
|
|
|
let start_date = new Date($("#hr-start-date").val()); |
|
|
|
let inputDate = moment($("#hr-start-date").val()); |
|
|
|
if (start_date < activityEarlyStart || start_date > activityEarlyFinish) { |
|
|
|
if (moment(inputDate).format('YYYY') >= moment(activityEarlyStart).format('YYYY')) { |
|
|
|
gantt.alert("Start date should be inside activity date range !"); |
|
|
|
if (inputDate.isBefore(moment(activityEarlyStart).format('YYYY-MM-DD')) || inputDate.isAfter(moment(activityEarlyFinish).format('YYYY-MM-DD'))) { |
|
|
|
$("#hr-start-date").val(""); |
|
|
|
gantt.alert("Start date should be inside activity date range !"); |
|
|
|
|
|
|
|
$("#hr-start-date").val(""); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#hr-end-date").on('change', (e) => { |
|
|
|
$("#hr-end-date").on('change', (e) => { |
|
|
|
let end_date = new Date($("#hr-end-date").val()); |
|
|
|
let inputDate = moment($("#hr-end-date").val()); |
|
|
|
if (end_date < activityEarlyStart || end_date > activityEarlyFinish) { |
|
|
|
if (moment(inputDate).format('YYYY') >= moment(activityEarlyStart).format('YYYY')) { |
|
|
|
gantt.alert("End date should be inside activity date range !"); |
|
|
|
if (inputDate.isBefore(moment(activityEarlyStart).format('YYYY-MM-DD')) || inputDate.isAfter(moment(activityEarlyFinish).format('YYYY-MM-DD'))) { |
|
|
|
$("#hr-end-date").val(""); |
|
|
|
gantt.alert("End date should be inside activity date range !"); |
|
|
|
|
|
|
|
$("#hr-end-date").val(""); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -190,12 +197,13 @@ $(document).ready(function () { |
|
|
|
let end_date = $("#hr-end-date").val(); |
|
|
|
let end_date = $("#hr-end-date").val(); |
|
|
|
let user_id = []; |
|
|
|
let user_id = []; |
|
|
|
let user_role = []; |
|
|
|
let user_role = []; |
|
|
|
users.map((item)=>{ |
|
|
|
users.map((item) => { |
|
|
|
let text = item.split('|'); |
|
|
|
let text = item.split('|'); |
|
|
|
user_id.push(text[0]); |
|
|
|
user_id.push(text[0]); |
|
|
|
user_role.push(text[1]); |
|
|
|
user_role.push(text[1]); |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (!users || users < 0) { |
|
|
|
|
|
|
|
|
|
|
|
if (!users || users.length === 0) { |
|
|
|
gantt.alert("Please choose user to assign!"); |
|
|
|
gantt.alert("Please choose user to assign!"); |
|
|
|
$('#btn-assign-hr').html('Assign'); |
|
|
|
$('#btn-assign-hr').html('Assign'); |
|
|
|
$('#btn-assign-hr').prop("disabled", false); |
|
|
|
$('#btn-assign-hr').prop("disabled", false); |
|
|
|