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.
 
 
 

67 lines
2.0 KiB

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);
$('#modal-material-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>`);
tableMaterial.draw();
});
$('#modal-material').on('hide.bs.modal', function (event) {
$("#show-form-material").show();
resetFormAssignMaterial();
});
});