You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

2 years ago
var hrModal = $('#modal-hr > .modal-dialog > .modal-content');
function resetFormAssign() {
2 years ago
$('#select-role-hr').val(null).trigger("change");
$('#select-role-hr').find('option').remove();
$('#select-role-hr').val("");
$('#select-hr').val(null).trigger("change");
$('#select-hr').find('option').remove();
$('#select-hr').val("");
$("#hr_role").val("");
$('#form-assign-hr').trigger("reset");
$('#btn-assign-hr').html('Assign');
$('#btn-assign-hr').prop("disabled", false);
2 years ago
};
$(document).ready(function () {
2 years ago
var tableHr = $("#table-hr").DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": `${base_url}user-to-activity/datatables`,
"data": function (d) {
d.idact = activityId;
}
},
"columns": [
{ data: 'user_name', name: 'user_name' },
{ data: 'role_name', name: 'role_name' },
]
});
$("#modal-hr").on("click", "#show-form-hr", function () {
$(this).hide();
$("#hide-form-hr").show();
$("#form-assign-hr").show();
});
$("#modal-hr").on("click", "#hide-form-hr", function () {
$(this).hide();
resetFormAssign()
$("#show-form-hr").show();
});
$('#modal-hr').on('show.bs.modal', function (event) {
$('#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>`);
2 years ago
tableHr.draw();
});
$('#modal-hr').on('hide.bs.modal', function (event) {
$("#hide-form-hr").hide();
$("#show-form-hr").show();
resetFormAssign();
});
});