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.

68 lines
2.0 KiB

2 years ago
var materialModal = $('#modal-material > .modal-dialog > .modal-content');
function resetFormAssignMaterial() {
2 years ago
$('#select-material').val(null).trigger("change");
$('#select-material').find('option').remove();
$('#select-material').val("");
$('#form-assign-material').trigger("reset");
$('#btn-assign-material').html('Assign');
$('#btn-assign-material').prop("disabled", false);
2 years ago
};
$(document).ready(function () {
2 years ago
var tableMaterial = $("#table-material").DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": `${base_url}assign-material/datatables`,
"data": function (d) {
d.idact = activityId;
}
},
"columns": [
2 years ago
2 years ago
{ data: 'material_name', name: 'material_name' },
{
data: 'qty_planning', render: function (data, type) {
return data ? formatRupiah(data) : '-'
}
},
2 years ago
{ data: 'uom', name: 'uom' },
{
data: 'budget', render: function (data, type) {
return data ? "Rp. " + formatRupiah(data) : '-'
}
},
2 years ago
{
data: 'plan_date', render: function (data, type) {
return data ? formatDate(data) : '-'
}
2 years ago
},
]
});
$("#modal-material").on("click", "#show-form-material", function () {
$(this).hide();
$("#hide-form-material").show();
$("#form-assign-material").show();
});
$("#modal-material").on("click", "#hide-form-material", function () {
$(this).hide();
resetFormAssignMaterial()
$("#show-form-material").show();
});
$('#modal-material').on('show.bs.modal', function (event) {
$('#modal-material-title').html("Material Resource " + activityName);
$('#modal-material-sub-title').html(`<p style="font-size: 12px; color: #747474">Plan Date: ${moment(activityEarlyStart).format('DD MMMM YYYY')} - ${moment(activityEarlyFinish).format('DD MMMM YYYY')}</p>`);
2 years ago
tableMaterial.draw();
});
$('#modal-material').on('hide.bs.modal', function (event) {
$("#show-form-material").show();
resetFormAssignMaterial();
});
2 years ago
});