|
|
|
var materialModal = $('#modal-material > .modal-dialog > .modal-content');
|
|
|
|
|
|
|
|
function resetFormAssignMaterial() {
|
|
|
|
$('#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);
|
|
|
|
};
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
var tableMaterial = $("#table-material").DataTable({
|
|
|
|
"processing": true,
|
|
|
|
"serverSide": true,
|
|
|
|
"ajax": {
|
|
|
|
"url": `${base_url}assign-material/datatables`,
|
|
|
|
"data": function (d) {
|
|
|
|
d.idact = activityId;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"columns": [
|
|
|
|
|
|
|
|
{ data: 'material_name', name: 'material_name' },
|
|
|
|
{
|
|
|
|
data: 'qty_planning', render: function (data, type) {
|
|
|
|
return data ? formatRupiah(data) : '-'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ data: 'uom', name: 'uom' },
|
|
|
|
{
|
|
|
|
data: 'budget', render: function (data, type) {
|
|
|
|
return data ? "Rp. " + formatRupiah(data) : '-'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: 'plan_date', render: function (data, type) {
|
|
|
|
return data ? formatDate(data) : '-'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#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);
|
|
|
|
tableMaterial.draw();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#modal-material').on('hide.bs.modal', function (event) {
|
|
|
|
$("#show-form-material").show();
|
|
|
|
resetFormAssignMaterial();
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|